0

I'm using selenium (with python) to test a website on an emulated android device (Android version 6 and Android version 5.1) on Sauce Labs.

Selenium tries to access a website using the native browser. Unfortunately the SSL certificate pops up when I try to access the website which stops the test. I want selenium to automatically click accept. The box that pops up looks like this:

Android security warning

Simply creating a certificate for the site isn't an option. I want Selenium to automatically click on the accept button. This is possible for Chrome, Firefox, Safari, IE, and mobile Safari (i.e. iOS), so it must also be possible for Android. Please let me know if you have any ideas! Thanks :)

1 Answer 1

0

I found that it is indeed possible to get selenium to automatically accept the SSL certificate for the native Android browser.

The code normally looks like:

from selenium import webdriver

caps = {'browserName': 'Android Browser'}
caps['platform'] = 'Linux'
caps['version'] = '6'
caps['deviceName'] = 'Android Emulator'
caps['deviceOrientation'] = 'portrait'
sauce_settings = 'http://{0}:{1}@ondemand.saucelabs.com:80/wd/hub'.format(
    SAUCE_USER, SAUCE_KEY,
)
driver = webdriver.Remote(
    command_executor=sauce_settings,
    desired_capabilities=caps,
)

The missing option, that needs to be added to automatically accept the ssl certificate, is this:

caps['acceptSslCerts'] = True

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .