from selenium import webdriver
import csv
import time
url_results=[]
driver_ie = webdriver.Ie('C:\\Users\\aviv\\Desktop\\IEDriverServer')
with open ('C:\\Users\\aviv\\Desktop\\urlspart.txt','r') as d:
urls= d.read().splitlines()
for i,url in enumerate(urls):
try:
print "URL: " + url
driver_ie.get(url)
time.sleep(7)
current_url_ie = driver_ie.current_url
redirect_ie='No'
if current_url_ie == 'https://www.aviv.com':
redirect_ie ='Yes'
except Exception,e:
redirect_ie = 'error'
print e, Exception
writer.writerow([i,url,redirect_ie])
ofile.close()
此代码抛出异常并显示消息:“Unable to get browser”。python中的硒webdriver - 无法获取浏览器
我已经更改了Internet选项 - >安全并签署了“启用保护模式”, 但是错误仍然存在。
任何解决方案?
你为什么要初始化'driver_ie'两次? –
我编辑它,这不是问题。 –
您可以粘贴完整的错误堆栈跟踪以进一步分析吗? – DebanjanB