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()
This code throw exception with message: "Unable to get browser".
I have already changed Internet Options --> Security and signed the "Enable protected mode", But the error still exists.
Anyone solution ?
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates.
For 32-bit Windows installations, the key you must examine in the registry editor is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
For 64-bit Windows installations, the key is
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0
Download the registry file from http://heliumhq.com/docs/internet_explorer .
See https://code.google.com/p/selenium/wiki/InternetExplorerDriver for this and more necessary IE configuration steps.
Also refer :
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/6511
Hope it will help you :)
May be because of missing .exe at end of the driver path. please add .exe as given below. it may be works for you.
driver_ie = webdriver.Ie('C:\\Users\\aviv\\Desktop\\IEDriverServer.exe')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.