If you are using Firefox version 48 or later, you must first download the Marionette Driver:
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver
Select the version suitable for your system (windows / linux, 32 or 64 bit), download it and update the Path system variable to add the full path to the executable file. See the official information in the change log: https://github.com/SeleniumHQ/selenium/blob/master/dotnet/CHANGELOG
Geckodriver is now the default mechanism for automating Firefox. This is the implementation of the Mozilla driver for this browser, and is required to automate versions of Firefox 48 and higher.
I'm not sure how you download selenium using eclipse. Did you download the libraries (banks) from your page and manually place them as external cans in Eclipse using the Java Build Path / Libraries option?
In any case, in my opinion, the easiest way is to convert the project into a Maven project:
- first install the Maven plugin using the Eclipse Marketplace option: http://www.eclipse.org/m2e/
right-click on the project in Eclipse, and then select "Configure / Convert to Maven Project". Then edit the pom.xml
file and add a dependency on the Selenium web page to it: http://docs.seleniumhq.org/download/maven.jsp
<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.0.1</version> </dependency>
All pom.xml
content in my sample project:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>WebKierowca</groupId> <artifactId>WebKierowca</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <sourceDirectory>src</sourceDirectory> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.0.1</version> </dependency> </dependencies> </project>
Finally, create the java class below, change the path pointing to the Marionette driver (geckodriver.exe), right-click on this class and run it as a Java application. If everything is in order, it should launch Firefox, go to the google web page, find the word "selenium" and display the search results for 5 seconds:
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Test { public static void main(String ... x){
source share