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.

Need to control chromedriver chrome language, but chrome_options can't be passed along

See original GitHub issue


Try to use chrome instead of firefox as it is faster and because firefox stop working recently for apparently selenium/splinter/firefox update missmatch of some kind…

I have ubuntu with french locales and chrome seems to be installed with french as a default language… My tests need to be executed in us-en chrome instance to succeed. Even if I set default language to us_en in chrome preferences the instance lauched by browser(‘chrome’) don’t seems to use the default profile preferences but the chrome built one or something.

So, I try many way to pass language specification to chrome instance without succes.

    from import Options
    import splinter
    options =
    browser = Browser('chrome', chrome_options=options)

Inspire by some answer from this SO question :

Not working…

    from selenium.webdriver import Chrome
    from import Options
    from splinter.driver.webdriver import BaseWebDriver, WebDriverElement

    options = Options()
    global browser
    browser = BaseWebDriver()
    browser.driver = Chrome(chrome_options=options)

This other option failed with the following error :

  do_login_if_need(username, base64.b64decode(password))

controllers/ controllers/ in do_login_if_need if browser.is_element_present_by_css(‘div.login_box’): /usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/ in is_element_present_by_css return self.is_element_present(self.find_by_css, css_selector, wait_time) /usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/ in is_element_present if finder(selector): /usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/ in find_by_css original_query=css_selector)

self = <splinter.driver.webdriver.BaseWebDriver object at 0x7fd3bc2b8d90> finder = <bound method WebDriver.find_elements_by_css_selector of < (session=“e32ee751b41d469e5138fac42c7d25e4”)>>, selector = ‘div.login_box’, original_find = ‘css’ original_query = ‘div.login_box’

def find_by(self, finder, selector, original_find=None, original_query=None):
    elements = None
    end_time = time.time() + self.wait_time

    func_name = getattr(getattr(finder, _meth_func), _func_name)
    find_by = original_find or func_name[func_name.rfind('_by_') + 4:]
    query = original_query or selector

    while time.time() < end_time:
            elements = finder(selector)
            if not isinstance(elements, list):
                elements = [elements]
        except NoSuchElementException:

        if elements:
            return ElementList(
              [self.element_class(element, self) for element in elements],
                find_by=find_by, query=query)

E AttributeError: ‘BaseWebDriver’ object has no attribute ‘element_class’

/usr/local/lib/python2.7/dist-packages/splinter/driver/webdriver/ AttributeError

I am not sure if It is me that don’t follow proper API fo BaseWebDriver or if the issue is somewhere else…

I think issues #326 and #382 are relate to mine…


Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

karlwnwcommented, Dec 11, 2017

Hi @BuhtigithuB,

A bit late, but just in case you still need it, I found that options.add_experimental_option("prefs", {"intl.accept_languages": "fr-FR"}) works.


Loschcodecommented, Apr 3, 2019

In Ruby, I used it this way if that can help anyone

  BROWSER_LANGUAGE = 'el' # could be en-US, fr-FR, etc.
  options =
  options.add_option('prefs', 'intl.accept_languages': BROWSER_LANGUAGE)
    browser: :chrome,
    desired_capabilities: capabilities,
    http_client: client,
    options: options
Read more comments on GitHub >

github_iconTop Results From Across the Web

DeprecationWarning: use options instead of chrome_options ...
chrome_options is deprecated now and you have to use options instead as well as pass the absolute path of the ChromeDriver along with...
Read more >
How to pass language setting to Chrome webdriver?
I have made this keyword: | Open URL in Google Chrome | [Arguments] | ${url} | | [Documentation] | Starts the Google Chrome...
Read more >
Capabilities & ChromeOptions - WebDriver for Chrome
The WebDriver language APIs provides ways to pass capabilities to ChromeDriver. The exact mechanism differs by the language, but most languages use one...
Read more >
WebDriver for Chrome - Capabilities & ChromeOptions
The WebDriver language APIs provides ways to pass capabilities to ChromeDriver. The exact mechanism differs by the language, but most languages use one...
Read more >
"Chrome is being controlled by automated test software ...
The current workaround for this is to pass in an option called "excludeSwitches" and then exclude the "enable_automation" switch. CAUTION: ...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found