3

I installed netbeans and then Selenium Client Driver and the step i have done after installing Client Driver:

  1. Open NetBeans IDE.
  2. Goto File->New Project->Categories Java and Projects Java Application and click next.
  3. Give the Project Name and Destination where it it will be saved and click finished.
  4. Right Click on project which is shown on the left side of NetBeans and select Properties 5.Add all jars with in the selenium-2.37.0 folder (selenium-2.37.0 + selenium-java-2.37.0-srcs.jar +All jar in libs folder)

After Completing this much steps also I couldn't start working on it..can anyone please tell if any other process I need to do after this, also please tell me how to start writing codes, because Iam new to webdriver

4
  • you should use at least selenium 2.44 jar instead of old version. Commented May 27, 2015 at 10:07
  • you should also share code you have written as your first test. Commented May 27, 2015 at 10:08
  • Check this steps : stackoverflow.com/questions/14974570/… Commented May 27, 2015 at 10:10
  • 1
    "I couldn't start working on it.." , what prevented you from starting working? You get errors or what? Commented May 27, 2015 at 11:00

1 Answer 1

5

Instead of downloading and using your own Selenium jars I would use Maven. Maven is used as a build tool and will download any dependencies you might need, like the latest version of Selenium.

Steps:

  1. Download & Install Netbeans with JDK at http://www.oracle.com/technetwork/java/javase/downloads/index.html (Also install JUnit with the installer)

  2. Install Firefox

  3. Create a new project: Maven -> Java Application

  4. Under project files edit pom.xml and add Selenium dependency

<dependencies>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.45.0</version>
  </dependency>
</dependencies>
  1. Right click project-name to get a menu and select: New -> Other. Pick the JUnit Test from the Unit Tests category. Next -> Finish.

  2. Pasted the following code to replace the JUnit test file

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

public class NewEmptyJUnitTest {

  @Test
  public void hello() {
    WebDriver driver  = new FirefoxDriver();
      driver.get("http://sqa.stackexchange.com/questions/13213/how-to-configure-selenium-webdriver-with-netbeans");
      WebElement acceptAnswerLink = driver.findElement(By.id("vote-accepted-13214"));
      acceptAnswerLink.click();  
    driver.quit();
  }
}
  1. Hit Ctrl-F6 to run the unit-tests

The result should be that Firefox starts opening this page and accepting this answer ;-)

Put the files on github: https://github.com/nreijmersdal/NetbeansMavenSelenium

9
  • Thanks for your reply ,But while doing 2nd step these much errors coming
    – ArYa
    Commented May 27, 2015 at 11:35
  • Failed to execute goal on project application: Could not resolve dependencies for project demo.crud.mvn:application:nbm-application:1.0-SNAPSHOT: The following artifacts could not be resolved: demo.crud.mvn:crudsample:jar:1.0-SNAPSHOT, demo.crud.mvn:branding:jar:1.0-SNAPSHOT: Could not find artifact demo.crud.mvn:crudsample:jar:1.0-SNAPSHOT in netbeans (bits.netbeans.org/maven2) -> [Help 1]
    – ArYa
    Commented May 27, 2015 at 11:37
  • To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. For more information about the errors and possible solutions, please read the following articles: [Help 1] cwiki.apache.org/confluence/display/MAVEN/…
    – ArYa
    Commented May 27, 2015 at 11:38
  • @ Niels van Reijmersdal can you please check the above problem
    – ArYa
    Commented May 27, 2015 at 12:13
  • I dont have netbeans installed, I dont think I will have time soon to verify it my self. Commented May 27, 2015 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.