Automated test with Selenium using netbeans

0

I am trying to reproduce the facebook page with selenium using NEtbeans java. but I get this error when doing the Test File.

  

OpenPagen caused an ERROR: Can not find firefox binary in PATH. Make   sure firefox is installed. OS appears to be: LinuxBuild info: version:   '3.12.0 ... (246 chars omitted).

Here the code and the dependencies of the pom.xml

import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class TransaccioIT {    

@Test
public void OpenPages(){
    WebDriver driver = new FirefoxDriver();
    String url = "http://www.facebook.com/";

    driver.get(url);
}
}

pom.xml

<dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.12.0</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>3.12.0</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12-beta-1</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>3.12.0</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
</dependencies>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
    
asked by TIM 06.06.2018 в 18:48
source

1 answer

0

You still need to download the driver that Selenium uses to control Firefox. You can download the driver from here.

link

Download the zip file and unzip it. Remember the route where you saved it, you will need it later.

In your Java code before creating an instance of FirefoxDriver you have to configure the system property with the driver path.

System.setProperty("webdriver.gecko.driver", "C:\Users\USER\Downloads");
  

The route does not have to include the driver itself, but the path of the folder that contains it.

In this case the binary would be stored in the Downloads folder.

Reference:

link

    
answered by 06.06.2018 в 21:20