window.chrome.runtime not available in chrome driver.

1,039 views
Skip to first unread message

yno...@gmail.com

unread,
Oct 21, 2015, 2:20:41 AM10/21/15
to ChromeDriver Users
When running the automation on the web app,
we were seeing that the app gets stuck at a certain page and doesn't load further.
We also notice a javascript error - window.chrome.runtime undefined.

Dev mentioned that they were using this in their js.

Steps to reproduce -
1. Start the selenium server with chrome driver.
java -jar -Dwebdriver.chrome.driver=chromedriver selenium-server-standalone-2.48.2.jar

2. Go to http://127.0.0.1:4444/wd/hub and create a new chrome session.
3. Open the console in this chrome session and enter window.chrome.runtime, this doesn't seem to be available.

If you open a regular chrome window, open the console and enter window.chrome.runtime - this is available.

Is there anyway to include window.chrome.runtime in the chrome session started by Selenium ?

bkso...@gmail.com

unread,
Jun 27, 2016, 4:33:34 PM6/27/16
to ChromeDriver Users, yno...@gmail.com
hey,
I am facing the same issue as well.
Did you happen to find a solution for this?

Thanks

gmani...@google.com

unread,
Jun 28, 2016, 6:50:49 PM6/28/16
to ChromeDriver Users, yno...@gmail.com, bkso...@gmail.com
In order to make 'chrome.runtime' API work in Chrome launched by Chromedriver, you would need exclude switch "--test-type".

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Arrays.asList("test-type"));

But excluding this switch will show info bars "You are using unsupported commang line flag.... " . You can disable such info bars by passing "--disable-infobar" switch.

options.addArguments("disable-infobars");

ben.a...@gmail.com

unread,
Jul 11, 2016, 3:31:52 PM7/11/16
to ChromeDriver Users, yno...@gmail.com
this worked for me...

capabilities = WebDriver.Capabilities.chrome().set('chromeOptions', {
args: [
'disable-infobars'
],
excludeSwitches: [
'test-type' // adds chrome.runtime object
]
}),
driver = new WebDriver.Builder()
.forBrowser('chrome')
.withCapabilities(capabilities)
.build()

jawa...@google.com

unread,
Aug 30, 2017, 8:18:22 PM8/30/17
to ChromeDriver Users, yno...@gmail.com

Was running into the same issue with a python based test.
Fixed the test by adding the following to my test setup.

chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('excludeSwitches', ['test-type'])

Leo Poniard

unread,
Jan 20, 2021, 6:13:49 PM1/20/21
to ChromeDriver Users
Hey,
I have exactly the same problem, 
Which got solved with :
chrome_options.add_experimental_option('excludeSwitches', ['test-type'])

But doesn't seem compatible with running the driver in headless mode :
chrome_options.add_argument("--headless")
(in headless mode, getting an empty page)

Did anyone had the problem before ?
Thank you

Reply all
Reply to author
Forward
0 new messages