How To Use Marionette Driver In Selenium 3 – Marionette GeckoDriver
Executing Selenium WebDriver Script in Firefox Browser using Marionette GeckoDriver :
Marionette Geckodriver – Launching Firefox Browser In Selenium 3:
What is Marionette Driver:
Marionette Driver (a.k.a GeckoDriver). The Marionette is an automation driver for Mozilla’s Gecko engine. It is the next generation of FirefoxDriver.
Here in this post, we see how to run Selenium WebDriver Script in Firefox Browser using Marionette GeckoDriver. Moving forward, we need to have geckodriver.exe and Selenium WebDriver.
Please be patient. The video will load in some time.
Assuming that you have already Installed Selenium WebDriver.
If you want to install Selenium WebDriver, click on the link below to install Selenium WebDriver in few clicks.
How To Download And Install Selenium WebDriver
Each and every browser has its own Driver to execute Selenium WebDriver Scripts. Selenium WebDriver supports browsers such as Mozilla Firefox, Google Chrome, Internet Explorer, Opera, Safari etc.,
Here we are going to see how to run Selenium WebDriver Script in Firefox Browser using Marionette Gecko Driver.
Why Marionette Geckodriver?
Selenium has launched Selenium 3 and if you are using Firefox latest version then you may face some issues.
To launch latest version of Firefox Browser using Selnium 3, we need to set a system property “webdriver.gecko.driver” to the path of executable file “geckodriver.exe”
Also find,
How to Run Selenium Webdriver Script in Firefox browser – Old Version
How to Run Selenium Webdriver Script in Internet Explorer
How to Run Selenium WebDriver Script in Chrome Browser
Step 1: Download GeckoDriver.exe
Click here to download Marionette Gecko driver
Download the latest release of Gecko driver and unzip the downloaded compressed file and keep it somewhere on a known location on your system.
Step 2: Executing the Test Script in Firefox Browser
Find the sample script (using Java) mentioned below to run test script in Firefox browser using Marionette Geckodriver. Execute it to run the test in Firefox browser which will first open Firefox browser and then open the appropriate URL mentioned in the script
SCRIPT:
package seleniumTutorial; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class GeckoDriver { public static void main(String[] args) { //Change the path based on your file path //System.setProperty("webdriver.gecko.driver","Path of geckodriver.exe") System.setProperty("webdriver.gecko.driver","D://Selenium Training//Selenium Environment Files//geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.get("https://www.softwaretestingmaterial.com/software-testing-interview-questions-free-ebook/"); System.out.println("Selenium Webdriver Script in Firefox browser using Gecko Driver | Software Testing Material"); driver.close(); } }
Common Issues You May Face:
Issue 1:
If you use old version of mozilla firefox (eg. firefox 45) and latest version of Selenium (Selenium 3.0.1) then you face the below mentioned error.
Exception in thread “main” java.lang.IllegalStateException
Issue 2:
If you use latest version of Mozilla Firefox (eg. Firefox 49) and old version of Selenium (Selenium 2.53) then you face the below mentioned error.
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms.
To overcome these issues, you need to download Gecko Driver as shown above.
If you are not regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.
Subscribe and get a free eBook and regular updates from SoftwareTestingMaterial.com