auto-download edgedriver window

master
ZouJiu 2023-11-11 15:50:01 +08:00
parent 4cf647fe6a
commit 7d40cf6c41
1 changed files with 5 additions and 2 deletions

View File

@ -947,12 +947,15 @@ def downloaddriver():
url = "https://msedgedriver.azureedge.net/116.0.1938.62/edgedriver_win64.zip" url = "https://msedgedriver.azureedge.net/116.0.1938.62/edgedriver_win64.zip"
if not os.path.exists(driverpath): if not os.path.exists(driverpath):
ret = requests.get("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/") ret = requests.get("https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/")
if ret.status_code!=200:
assert ret.status_code!=200
ret = BeautifulSoup(ret.content, 'html.parser') ret = BeautifulSoup(ret.content, 'html.parser')
ddl = ret.find_all('a', class_='driver-download__link') # divall = ret.find_all('div', class_=r'common-card--lightblue')
ddl = ret.find_all('a')
for k in ddl: for k in ddl:
key = k.attrs.keys() key = k.attrs.keys()
href = k.attrs['href'] href = k.attrs['href']
if 'href' in key and "win64" in href: if 'href' in key and "win64" in href and ".zip" in href:
url = href url = href
break break
response = requests.get(url) response = requests.get(url)