question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to set capabilities on Chrome WebDriver

See original GitHub issue

I am trying to use pytest-splinter fixtures splinter_webdriver and splinter_driver_kwargs to enable Chrome to run in Incognito mode and ignore certificate errors to enable testing from a local dev environment versus a hosted site with valid certs.

I am unable to find the combination of arguments that make Chrome work, and conversely, make Firefox break.

When I do not use the fixtures and just create my own splinter Browser instance it works fine.

@pytest.fixture(scope='session')
def my_browser():
    caps = webdriver.DesiredCapabilities.CHROME.copy()
    caps["acceptInsecureCerts"] = True
    caps["acceptSslCerts"] = True

    browser = Browser('chrome', incognito=True, desired_capabilities=caps)
    return browser

However, in my desired scenario, when splinter_webdriver returns “chrome” and splinter_driver_kwargs returns any of the following configurations, the invalid cert authority error has not been bypassed. Also, of note, attempting to override the capabilities for FireFox and force it to fail on the invalid certs also does not work.

def splinter_driver_kwargs():
    chrome_options = webdriver.ChromeOptions()
    chrome_options.set_capability("acceptInsecureCerts", True)
    chrome_options.set_capability("acceptSslCerts", True)

    # caps = webdriver.DesiredCapabilities.CHROME.copy()
    # caps["acceptInsecureCerts"] = True
    # caps["acceptSslCerts"] = True

    # XXX just a test to try and break FF on insecure certs, but it does not work =(
    # caps = webdriver.DesiredCapabilities.FIREFOX.copy()
    # caps["acceptInsecureCerts"] = False

    return {
        "incognito": True,
        "options": chrome_options,
        # "capabilities": caps,
        # "desired_capabilities": caps
    }

What are the recommended steps in this case?

Thanks.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jacecommented, Aug 2, 2022

Found it: from selenium import webdriver

0reactions
mpasternakcommented, Aug 8, 2022

Merged #167. Closing this issue, as the documentation in #167 somehow explains what to do in case reported by @aahamlin . On the other hand, if you need any other assistance, please reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Selenium “Unable to find a matching set of capabilities ...
I'm alredy using the latest version of selenium i.e 3.141.0 for python, have latest firefox version i.e 64.0 and latest geckodriver i.e 23.0,...
Read more >
Capabilities & ChromeOptions - WebDriver for Chrome
Capabilities are options that you can use to customize and configure a ChromeDriver session. This page documents all ChromeDriver supported capabilities and how ......
Read more >
[ Bug]: Selenium Hub 3.141.59: Unable to set Chrome ...
On selenium hub 3.141.59, We are unable the change the chrome default download ... capabilities = new DesiredCapabilities(); capabilities.
Read more >
WebDriver for Chrome - Capabilities & ChromeOptions
Capabilities are options that you can use to customize and configure a ChromeDriver session. This page documents all ChromeDriver supported capabilities and ...
Read more >
7. WebDriver API — Selenium Python Bindings 2 documentation
Set of default supported desired capabilities. Use this as a starting point for creating a desired capabilities object for requesting remote webdrivers for ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found