0

Chrome Driver getting stuck/unable to launch url when adding extensions

ChromeBrowser 74.0.3729.131 (Official Build) (64-bit)
ChromeDriver 74.0.3729.6
SeleniumDriver selenium-server-standalone-3.141.59

public class ChromeBrowser {

    public static void main(String args[]){

        try{
            //Code working with out extensions
            System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
            WebDriver driver = new ChromeDriver();
            driver.get("http://www.google.com");

            //Code failed with extensions
            ChromeOptions options = new ChromeOptions();
            options.addExtensions(new File("./drivers/modheader_2_1_2.crx"));
            DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability(ChromeOptions.CAPABILITY, options);
            ChromeDriver drivers = new ChromeDriver(capabilities);
            drivers.get("http://www.google.com");
        }
        catch(Exception e){
            System.out.println("Exception caught :: "+e.getMessage());
        }

    }
}
sanyassh
  • 8,100
  • 13
  • 36
  • 70
Praveen
  • 89
  • 5
  • First thing, this is not a duplicate issue. Second, I got to found the issue in the right place. Please refer, https://bugs.chromium.org/p/chromium/issues/detail?id=957538&can=2&q=957538 && https://bugs.chromium.org/p/chromedriver/issues/detail?id=2929&can=2&q=2929&colspec=ID%20Status%20Pri%20Owner%20Summary&sort=-id – Praveen Jun 03 '19 at 06:32
  • In simple terms, This is a Chromium bug 957538 which is fixed in Chrome v75. Please update and run your tests with Chrome/ChromeDriver v75. – Praveen Jun 03 '19 at 06:33

2 Answers2

0

adding extentions is a chrome capability , so you can discount these two lines

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);

and pass

ChromeDriver drivers = new ChromeDriver(options);

to ChromeDriver

Ramprasad
  • 328
  • 1
  • 3
  • 7
  • This is a Chromium bug 957538 which is fixed in Chrome v75. Please update and run your tests with Chrome/ChromeDriver v75. – Praveen Jun 03 '19 at 06:33
0

If yours is a maven project, adding a chromedriver dependency might solve your issue

If your selenium version is 3.14.0, try adding a chromedriver dependency 3.14.0 version

https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver/3.14.0

This worked for me, since previous versions of chromedriver does not have the functions working for the latest chrome driver or has changed. If your test fails and says something like NoSuchMethodError, then try this solution

  • This is a Chromium bug 957538 which is fixed in Chrome v75. Please update and run your tests with Chrome/ChromeDriver v75. – Praveen Jun 03 '19 at 06:33