简体   繁体   中英

Not able to open Internet Explorer 11 with Selenium Python bindings

I first started with the latest IEDriverSErver.exe v3.5.0 with enabled protected mode enabled for all the security zones and the registry FEATURE_BFCACHE subkey DWord value to 0.

I would run the following code

from selenium import webdriver driver = webdriver.Ie()

And get an Error

 Message: Invalid capabilities in alwaysMatch: unknown capability named platform.

Next I tried to use IEDriverServer.exe v3.4.0 with the same settings and get the a different error, but the IE11 browser would open, but I can't control it due to error

Message: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070005 ('Access is denied.') for URL 'http://localhost:56039/'

I am pretty new at python and having regained the fun with coding again. I used to avoid programming in the past, but with a new outlook started to tackle python again and enjoying it. Now for the question:

I am trying to get python selenium module to open a Internet Explorer 11 browser but seem to having a bit of trouble.

If anyone has any tip, tricks, help, or pointers, it would be greatly appreciated.

Thanks,

Learning Python Programmer Python 3.5.0 Selenium 3.5.0 Internet Explorer 11 Version 11.0.9600.1872CO IEDriver 3.5.0 and 3.4.0

While working with Selenium 3.5.0 , IEDriverServer 3.5.0 and IE 11 you can consider to adapt to the configuration mentioned in this documentation and try the following code block:

from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

capabilities = DesiredCapabilities.INTERNETEXPLORER
capabilities["platform"] = "WIN8"
capabilities["browserName"] = "internet explorer"
capabilities["ignoreProtectedModeSettings"] = True
capabilities["IntroduceInstabilityByIgnoringProtectedModeSettings"] = True
capabilities["nativeEvents"] = True
capabilities["ignoreZoomSetting"] = True
capabilities["requireWindowFocus"] = True
capabilities["INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS"] = True

browser = webdriver.Ie(capabilities=capabilities, executable_path="C:\\Utility\\BrowserDrivers\\IEDriverServer.exe")
browser.get("https://www.facebook.com/")

Possible workaround for the unknown capability named platform issue can be found here .

Basically you delete platform and version keys from the capabilities .

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM