How to accept security certificates while using Selenium?

How to accept security certificates while using Selenium?

QA 0

To accept untrusted website security certificates while automating with Selenium, it’s possible to set a particular option on the driver that you’re using (Firefox, Chrome, IE). Most recently, this option is called ‘acceptInsecureCerts‘, however it doesn’t always work, particularly on newer versions of IE and Firefox.

If you run into this issue with newer browser versions, it’s possible to leverage AppRobotic to either:

1. Use AppRobotic Vision to locate the image of the button on-screen and click it to accept the certificate, using the ImageClick Action.
2. Simply move the mouse to specific coordinates on the screen, and perform a mouse click action. Example below:

Python Code:

import win32com.client
x = win32com.client.Dispatch("AppRobotic.API")
from selenium import webdriver
# navigate to Instagram
driver = webdriver.Firefox()
driver.get('https://www.RandomWebsiteWithInsecureCertificateWarning.com')
# sleep 1 second
x.Wait(1000)
# Move mouse to coordinates 250, 500 on the screen
x.MoveCursor(250,500)
x.MouseLeftClick
# sleep 1 second
x.Wait(1000)