xmcp
xmcp

Reputation: 3742

Failed to pass arguments to chrome driver in selenium

I use selenium to test my chrome extension, and I recently found the Travis-CI reported a failing status.

travis-ci screenshot

I reproduced the problem and realized chrome didn't even load my extension.

Here is a short example:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

opt=Options()
opt.add_argument('load-extension=/path/to/src')
opt.add_argument('--user-agent=foobar')

b=webdriver.Chrome('driver/chromedriver',chrome_options=opt)
print(b.execute_script('return navigator.userAgent'))

The chrome launched without the extension loaded, and the user agent string was still the default one (Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36).

The chrome driver I'm using is v2.33 with google-chrome-stable (62.0.3202.75-1). The OS is Ubuntu 14.04 LTS (this bug is not reproduceable in Windows).

I'm wondering is it a bug in a recent update in chrome or selenium, as the code was working 3 days ago.

Is there any workaround for this bug?

(sorry for my poor English)

Upvotes: 0

Views: 769

Answers (1)

xmcp
xmcp

Reputation: 3742

Comparing 2 build outputs, the version of selenium changed from 3.6.0 to 3.7.0.

enter image description here

Downgrading selenium to selenium==3.6.0 will fix the problem.

Upvotes: 2

Related Questions