Collections:
Firefox WebDriver Test with Selenium Java API
How to create a test program using Firefox WebDriver with Selenium Java API?
✍: FYIcenter.com
Here is a simple test program that the Firefox WebDriver Test with the Selenium Java API:
C:\fyicenter> type FirefoxTest.java import org.openqa.selenium.*; import org.openqa.selenium.firefox.*; public class FirefoxTest { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com"); driver.quit(); } }
Compile and run it with the Selenium Client JAR file:
C:\fyicenter> javac -classpath \ \fyicenter\selenium\java\client-combined-3.141.59.jar \ FirefoxTest.java C:\fyicenter> java -classpath \ .;\fyicenter\selenium\java\client-combined-3.141.59.jar;\ \fyicenter\selenium\java\libs\guava-25.0-jre.jar;\ \fyicenter\selenium\java\libs\okhttp-3.11.0.jar;\ \fyicenter\selenium\java\libs\okio-1.14.0.jar;\ \fyicenter\selenium\java\libs\commons-exec-1.3.jar \ FirefoxTest Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases at com.google.common.base.Preconditions.checkState(Preconditions.java:847) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:134) at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:44) at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:167) at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:355) at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:190) ...
As you can see, we are missing the Mozilla GechoDriver. See next tutorial on how to fix it.
Â
⇒ Use Firefox WebDriver with Mozilla GechoDriver
⇠Compatibility of WebDriver Java API for Chrome
⇑ Starting with Selenium WebDriver Client Java API
⇑⇑ Selenium Tutorials
2020-01-29, 1110👍, 0💬
Popular Posts:
How to generate currency test values? Currency test values are frequently needed in testing date and...
Where to find online test tools? FYIcenter.com has prepared a number of online test tools: Data Look...
How to Open and Close Internet Explorer with UFT script? One way to open and close Internet Explorer...
How to generate ISBN numbers? To help you to obtain some ISBN numbers for testing purpose, FYIcenter...
How to perform regular expression pattern match with multiple occurrences? To perform a regular expr...