Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
options.set_capability={"acceptInsecureCerts", True}
options.set_capability={"ignoreProtectedModeSettings":True, "ignoreZoomSetting":True}
driver = webdriver.Ie(options=options,executable_path='D:/
Project/Testing/IEDriverServer_Win32_3.150.1/IEDriverServer.exe')
driver.get(url)
options.set_capability={"ie.ensureCleanSession",True}
driver.close()
Method 2:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
desired_capabilities = DesiredCapabilities.INTERNETEXPLORER.copy()
desired_capabilities['acceptInsecureCerts'] = True
driver = webdriver.Ie(capabilities=desired_capabilities,executable_path='E:/DriverServer_Win32_3.150.1/IEDriverServer.exe')
driver.get(url)
print(driver.title)
driver.close()
**Can't share the URL therefore I have just written URL word
I tried both code but it's not working
Is there any another solution ?**
The acceptInsecureCerts
capability doesn't work because IE doesn't allow to accept it. You can refer to this link for more detailed information.
In IE 11, you can click the link Go on to the webpage (not recommended) as a workaround to bypass the SSL certificate error. This link has an id "overridelink". You can find the id using F12 dev tools.
I use this site: https://expired.badssl.com/ as an example, the sample code is like below:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import time
url = "https://expired.badssl.com/"
ieoptions = webdriver.IeOptions()
ieoptions.ignore_protected_mode_settings = True
driver = webdriver.Ie(executable_path='IEDriverServer.exe', options=ieoptions)
driver.get(url)
time.sleep(3)
driver.find_element_by_id('moreInfoContainer').click()
time.sleep(3)
driver.find_element_by_id('overridelink').click()
It works well in IE 11, you can also try the same method.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.