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

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

  • Thanks for your reply ,But while doing 2nd step these much errors coming – ArYa May 27 '15 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 May 27 '15 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 May 27 '15 at 11:38
  • @ Niels van Reijmersdal can you please check the above problem – ArYa May 27 '15 at 12:13
  • I dont have netbeans installed, I dont think I will have time soon to verify it my self. – Niels van Reijmersdal May 27 '15 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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