Selenium webdriver using Eclipse

To start selenium scripting with Eclipse, you need to first install Java Development Kit (JDK) Download and Install Java

Installing eclipse is very easy, First download eclipse . The downloaded file should be a .zip file. Place it in a folder and ensure that you have full read and write permissions. Try to create a shortcut of the eclipse executable file.

You can check in Eclipse from Window->Preferences options, if java is installed and configured successfully on Eclipse. You can also check the java version from command prompt, enter 'java -version' which will display the java version installed on your machine.
Now we will start creating our first program in selenium using java from Eclipse Editor.

Now start writing First example to launch Firefox browser using Selenium Webdriver java

1.Create new Java Project
[From top menu file->New->Project/Java Project and enter the project name]

2.Create a new Package under Project
[Give any name to the package]

3.Create a new Java class file under the Package
[Give a name to the class]

4. Next add the selenium server Jar files to the Project. Download Selenium Server
[Right click on the Project Name, Mouse over on Build Path and select 'Configure Build Path', Select Libraries tab, Click on Add External Jars and select the selenium server jar from your local machine]

Selenium Firefox Example

5.Write the script in the Java and execute it by right clicking on the program and Run as Java Program.

NOTE: If you are using selenium 3, please use GeckoDriver to launch Firefox browser

Please find the below example program to open Google in Firefox browser

package com.easy;

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

public class OpenGoogle {
	public static void main(String args[]) {

		WebDriver driver = new FirefoxDriver();
		System.out.println("Hello Google...");
		driver.get("http://google.com");

	}
}

Make sure always download latest version of selenium and supported Firefox version until there is no specific requirement to execute on particular version. You may have compatibility issues which you need check if any issues arises when working.

Selenium Tutorials: 

Comments

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

how to open firefoxbrowser without using firefoxDriver class

can some one help with this

Thanks

I am using selenium 3.2.0 and Firefox with gecko driver 0.15 on MAC os and unabel to open any URL in Firefox browser.
Can anyone please suggest any solution to this?

How to write a reusable script that uses to run tests on chrome and firefox ?

Hi ,
i am not able to run scripts in Fire Fox Browser ,getting below error
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:

firefox 46.0 version and Selenium 2.53
so please help me on this

The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
The above error is thrown when i tried to change ChromeDriver(), also imported ChromeDriver libraries

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.