Friday, November 22, 2013

Selenium Web Driver Configuration With NetBeans

Here we try to configure Selenium Web Driver(Java Client) with Net Beans

Step 1 - Install Java And NetBeans In Machine  ............

Download and Install JDK(Java Development Kit) from here .


JDK comes with JRE(Java Runtime Environment) so don't need to download it separately.Try to use new version of JDK.

Download NetBeans from here and install it.We can download full package of NetBeans or only the Java SE NetBeans package.



We may download the combined package of JDK+NetBeans from here and installed the combined package.Using this we don't need to install JDK and NetBeans separately.


NetBeans is just an editor, we may also use Eclipse as an editor. In another post we can see how to configure Eclipse for Selenium WebDriver.


Step 2 - Download Selenium Java Client  ............

Download Selenium Client Driver from here .You will find client drivers for other languages there, but only choose the Java client.
After download completed extract the files from Selenium-Java-2.37.0.zip,it look like this

Open the the libs folder we can see more jar files are there like this........



Step 3 - Configure NetBeans IDE With Selenium WebDriver  ............

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)......
6.After adding the all jar this should be shown on the NetBeans.....
7.Now we are ready to write code in NetBeans using Selenium WebDriver.Here we write some code like

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SeleniumWebDriverEx1;

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

/**
 *
 * @author
 */
public class SeleniumWebDriverEx1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
      
        //Here we initialize the firefox webdriver
        WebDriver firefoxDriver=new FirefoxDriver();
      
        //Open the url which we want in firefox
        firefoxDriver.get("Http://www.google.com");


    }
}


8.We run the project then firefox will be opened and show the google page like this
If we observed the firefox window we can see that WebDriver word is written into the below of this page because it is opened by the Selenium WebDriver.






Step 1 – Install Java on your computer
Read more at http://www.guru99.com/installing-selenium-webdriver.html#7HRV5yfx1bvgAC6G.99
Step 1 – Install Java on your computer
Read more at http://www.guru99.com/installing-selenium-webdriver.html#7HRV5yfx1bvgAC6G.99
Step 1 – Install Java on your computer
Read more at http://www.guru99.com/installing-selenium-webdriver.html#7HRV5yfx1bvgAC6G.99
Step 1 – Install Java on your computer
Read more at http://www.guru99.com/installing-selenium-webdriver.html#7HRV5yfx1bvgAC6G.99
Step 1 – Install Java on your computer
Read more at http://www.guru99.com/installing-selenium-webdriver.html#7HRV5yfx1bvgAC6G.99

26 comments:

  1. Very good and detailed effort. Really appreciate.........

    ReplyDelete
  2. Really Nice and Understandable tutorial. Pretty much helpfull for new larners ....

    ReplyDelete
  3. Helped me to configure NetBeans. Thanks.

    ReplyDelete
  4. Thank you, I can configure NetBeans.

    ReplyDelete
  5. Nice post but it didn't get me 100% there. I had a Java exception and had to download and add the Selenium stand alone JAR too. Then it worked.

    ReplyDelete
    Replies
    1. I am really sorry for that this post can not help you 100%.But here each step executed by me and get success then I post it here. I can not understand why it can not work for you.Can you please told me the java exception?Selenium client jar version?did you add selenium-2.xx.0 + selenium-java-2.xx.0-srcs.jar in your project lib.This jars are located outside of the downloaded selenium lib folder.

      Delete
  6. Hi Arjun, thanks for the excellent post. I've been struggling all day to get NetBeans working until I found your post. I too had the same problem as Chris above and found the resolution on stackoverflow: http://stackoverflow.com/questions/5134953/noclassdeffounderror-in-java

    If only I'd scrolled down these comments first I would have found the cause :-)

    ReplyDelete
  7. Nice post. However it opens Firefox 32 but do not set any url later. Do you know where is the problem?

    ReplyDelete
    Replies
    1. Sorry for late reply.......Can You please download the new WebDriver java client and configure it.

      Delete
  8. I had the "java.lang.NoClassDefFoundError" error as Chris.
    Added all JARs in libs folder + selenium-java-2.44.0.jar & fixed.
    Thanks.

    ReplyDelete
  9. Thank you so much!! It was so easy for what i was trying to past many days! Thanks for the effort!

    ReplyDelete
  10. Yes, I also found Class not found exception. It can be fixed by importing all the jar in lib folder.

    Previously I have imported just folder under lib, it will not work.Select all the jar inside from the folder and put directly under lib folder.

    ReplyDelete
  11. man, this tutorial was helpfull for me. thanks very much for this.

    ReplyDelete
  12. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Netbeans, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Netbeans. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Nitesh Kumar
    MaxMunus
    E-mail: nitesh@maxmunus.com
    Skype id: nitesh_maxmunus
    Ph:(+91) 8553912023
    http://www.maxmunus.com/




    ReplyDelete
  13. This is very good content you share on this blog. it's very informative and provide me future related information. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.
    Selenium online training
    Selenium certification training
    Selenium online course
    Selenium training course

    ReplyDelete
  14. valuable information.. but if u still looking for top 10 web hosting companies visit Top 10 Web Hosting Companies
    for detailed information.

    ReplyDelete