Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

window.chrome.runtime is undefined for selenium webdriver

I am using Selenium for testing. I noticed a different behavior starting Chrome manually and starting it with selenium. After a lot of investigation I broke the problem down to JavaScript's window.chrome.runtime which is undefined if started with selenium.

After some research on Google I have found people facing similar issues, but none of their solutions worked for me.

I have tried so far to remove the test-type switch:

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

Are there any other ways I can make it work?

like image 270
Carle B. Navy Avatar asked Jul 01 '26 19:07

Carle B. Navy


1 Answers

Answer which did the job for me was at https://groups.google.com/forum/#!topic/chromedriver-users/7wF9EHF2jxQ

Code snippet:

ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Arrays.asList("test-type"));
like image 121
Cristian-Florin Pandele Avatar answered Jul 04 '26 07:07

Cristian-Florin Pandele



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!