How to test multiple version of google chrome using chromedriver?

无人久伴 提交于 2019-12-24 14:34:46

问题


selenium web-driver with java then how to use chrome driver for test their lower version of Google chrome


回答1:


From the official wiki page:

Overriding the Chrome binary location

You can specify the location of the Chrome binary by passing the "chrome.binary" capability, e.g. with a typical Chromium install on Debian:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary", "/usr/lib/chromium-browser/chromium-browser");
WebDriver driver = new ChromeDriver(capabilities);

I suggest you try this approach - tell where the binary of lower version is and start ChromeDriver. Never tried it, but I think it might work




回答2:


You would use capabilities to point to the right binary file of the browser to be launced.But not all versions of chrome browser is supported by different versions of chromedriver. You will find exceptions stating that version of browser expected is greater or equal to 30.0.

For ex:- Chromium Browser(33.0.1729.0 )works fine with ChromeDriver 2.7 and not the with the older ones.

You can choose from all the chromedriver version available from the link below:- http://chromedriver.storage.googleapis.com/index.html




回答3:


Install chrome to custom location, be sure to turn off auto-update. Use following code to use non-default binary.

    ChromeOptions options = new ChromeOptions();
    options.setBinary("/path/to/binary");

    DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
    desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options);

    WebDriver webDriver = new ChromeDriver(desiredCapabilities);


来源:https://stackoverflow.com/questions/16561969/how-to-test-multiple-version-of-google-chrome-using-chromedriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!