How to test multiple version of google chrome using chromedriver? - testing

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

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

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

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);

Related

ChromeDriver run without Chrome installed?

Short question. Is there possibility to run chromedriver and selenium work without chrome app installed?
Thanks
The answer is No. You have to have the chrome application inside your computer. However, you do not need t install it. It will work with any portable Chrome versions as well.
You simply have to point to the chrome executable location during tests.
ChromeOptions options = new ChromeOptions();
options.setBinary("/path/to/chrome/binary");
ChromeDriver driver = new ChromeDriver(options);

which firefox version is compatible with selenium 3.5.0?

I tried with Selenium 3.5.3 GeckoDriver 0.19 Firefox 55 but getting below exception:
Error: org.openqa.selenium.WebDriverException: browser name not boolean
Code :
DesiredCapabilities cap = DesiredCapabilities.firefox();
WebDriver driver = null;
System.setProperty("webdriver.gecko.driver", "<path to gecko>\geckodriver.exe");
cap.setBrowserName("firefox");
URL sURL= null;
cap.setCapability("firefox_binary", "<FIREFOX_PATH>"));
//Grid
sURL = new URL("http://localhost:5555/wd/hub");
driver = new RemoteWebDriver(sURL, cap);
Also saw this thread https://seleniumhq.wordpress.com/2017/08/09/firefox-55-and-selenium-ide/ that selenium ide would not be supported anymore in Firefox 55. Whether selenium jar would be still supported?
It was a bad news for the tester community since Selenium IDE no long works from Firefox 55 onwards. Now you have 2 choices:
1- Try with previous version of firefox (Temporary solution)
2- Use Selenium IDE alternatives (Highly Recommended)
I recommend you to use Firefox 54.0 and geckodriver v0.18.0.
Actually this links regarding Selenium IDE. You can use firefox 55 also.

Remove security message using Selenium WebDriver with Java

While running Selenium automated tests on Chrome, I get following type of error message:
You're using an unsupported command line flag: ignore-certificate-errors. Stability and security will suffer
Can someone please suggest how can I remove it using Selenium WebDriver with Java?
Set mode "test-type" to ChromeDriver capabilities
Here's my sample code in Java
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type", "start-maximized",
"no-default-browser-check");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
If you are using chrome version 35.x, this kind of pop-up will come. Try using chrome version 34.x and then see.
Actually its the problem with chrome builds. Just give it a try.
Thank you,
Shravan Kumar.T

How to run selenium tests in headless mode on Mac using Webdriver with firefox 17.0.1

How to run Automated selenium tests in Mac OS 10.8 with firefox 17.0.1 using Xvfb(X-virtual frame buffer)
Anyone help me regarding this configuration.
I don't think such old Firefox version is still relevant. But for those who still want to use old Firefox versions - take a look at Selenoid project. This is a lightweight Selenium-compatible server coming with a set of prebuilt Docker images for all Firefox versions starting with 3.6. All images include Xvfb inside, so this solution is completely headless.
Will you try adding this option to your binary of Firefox if you are using
binary of Firefox.
binary.addArguments("-headless");
If you are not using binary and using driver as new Firefox driver then
FirefoxOptions fireFoxOptions = new FirefoxOptions();
fireFoxOptions.addArguments("-headless");
DesiredCapabilities firefoxcapabilities = DesiredCapabilities.firefox();
capabilities.setCapability(ChromeOptions.CAPABILITY,fireFoxOptions);
WebDriver firefoxdriver = new FirefoxDriver(firefoxcapabilities);
Also, this is a very old version of Firefox I will prefer upgrading the version if you don't have any restrictions upgrading it.

how to use different version of firefox using webdriver?

how to set Firefox version in web-driver?
I just want to user different version of Firefox.
like different version 19, 20 , 21....
please provide a generic solution which help for other browser also.
You have to install all the versions on your system. Then you can use the System property webdriver.firefox.bin to define the path for Firefox. Note than since the path is set through a System property, you will not be able to run two different Firefox in the same Java process.
This solution is specific to Firefox. There is no generic solution. You have to configure every WebDriver yourself.
More information about the configuration of Firefox Web Drvier.
Finally i have found solution to run with different browser version
System.setProperty("webdriver.firefox.bin", "/Applications/Firefox-2.app/Contents/MacOS/firefox-bin");
WebDriver driver = new FirefoxDriver();
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
driver.quit();
I have found how to start a different FireFox browser (actually WaterFox) in Python Selenium, replacing
driver = webdriver.Firefox()
with
driver = webdriver.Firefox(firefox_binary = "/path/to/my/waterfox")
(Ubuntu 20.04, Python 3.95)