http://www.bathome.net/viewthread.php?tid=62770&highlight=%BB%F9%D3%DA
参考这个操作浏览器,先下好对应的selenium库文件和edge驱动程序- <# :
- cls&@echo off
- set "url=https://market.m.taobao.com/app/eleme_nr_bfe_retail/eb_download/index.html"
- set "de=C:\A\B"
- rem 以上设置网址和下载目录
- cd /d "%~dp0"
- powershell -NoProfile -ExecutionPolicy bypass "Invoke-Command -ScriptBlock ([ScriptBlock]::Create([IO.File]::ReadAllText('%~f0',[Text.Encoding]::GetEncoding('GB2312')))) -Args '%url%','%de%'
- exit
- #>
- using namespace 'OpenQA.Selenium'
- Get-ChildItem '*.dll' | % {[void][System.Reflection.Assembly]::LoadFile($_.FullName)}
- $edge = [Edge.EdgeDriver]::new()
- $edge.Url = $args[0]
- sleep 1
- $href = $edge.FindElement([by]::classname('gray-btn')).GetAttribute('href')
- Write-Host $href
- $edge.Close()
- $edge.Dispose()
- Start-BitsTransfer -Source $href -Destination $args[1]
复制代码
|