how to use different version of firefox using webdriver? - selenium

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)

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

Selenium with firefox addons?

Just wondering, is there anyway to use selenium with firefox addons? I installed an addon but whenever i start the selenium driver it seems to kick off firefox without it. just curious
it simple like this
profile = webdriver.FirefoxProfile()
profile.add_extension("/path/to/file.xpi")
driver = webdriver.Firefox(profile)

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.

Why do we need IEDriver and ChromeDriver but no Firefox Driver?

I have small doubt.
Why do we need IEdriver and Chrome Driver running selenium scrits in IE and Chrome but we do not need a firefox driver to run the script?
Is there any reason for the same?
This is because of the Native Browser approach used in WebDriver.
Each and every browser uses different JS Engine.
All drivers [Chrome Driver, IE driver, etc.,] are built based on the special JS Engine used by each browser.
Selenium offers inbuilt driver for Firefox but not for other browsers. [Not sure it may happen in future, since TestNG and JUnit library files are a part of Selenium-standalone-server right now]
Straight from a google search for FirefoxDriver, the official documentation states:
Firefox driver is included in the selenium-server-stanalone.jar available in the downloads. The driver comes in the form of an xpi (firefox extension) which is added to the firefox profile when you start a new instance of FirefoxDriver.
External drivers are the preferred process by the Selenium developers. They allow the driver versioning to be tied more closely to the browser than to Selenium, and they can be supported by the browser authors (e.g., ChromeDriver, OperaDriver). There is a long-standing plan to replace FirefoxDriver with a Mozilla-supported driver based on Mozilla's "Marionette" architecture.
Firefox driver is already included in the selenium-server-standalone.jar package.

How to test multiple version of google chrome using chromedriver?

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