I am using eclipse-jee-luna-SR1-win32-x86_64 for Selenium (the Selenium version is selenium-standalone-2.44.0 and selenium-java-2.44.0). I am getting the error The type is deprecated
. I have JavaSE-1.8 installed on my system.
> java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
This is the code I'm using:
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class FirstTestCase {
public static void main(String[] args) {
System.out.println("Hello World");
Selenium selenium = new DefaultSelenium("localhost", 5555, "chrome", "http://www.xxxxxxyxyxyx.com");
}
}
The Selenium
Interface and DefaultSelenium
Class both belong to Selenium 1 and are deprecated. Selenium has advanced to Selenium 2 (WebDriver) and for this reason these warning messages are displayed to encourage users to stop using old Selenium 1 code and start using Selenium 2 (WebDriver) code.
To add: This has got nothing to do with your IDE (Eclipse) or your Java version.
You will want to use the following classes as these are part of Selenium 2 (WebDriver). WebDriver
is an interface used by various Selenium 2 drivers
.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Then you have various drivers that you can use. RemoteWebDriver
/ HtmlUnitDriver
/ FireFoxDriver
/ ChromeDriver
/ IEDriverServer
etc. You will want to import
the driver in your Java class.
Selenium selenium = new DefaultSelenium();
Becomes
WebDriver driver = new TheSpecificDriver();
According to this selenium mirror on github
You should migrate to using WebDriver.
Just enhancing my answer, you might find this tutorial helpful https://code.google.com/p/selenium/wiki/GettingStarted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With