Why am I getting "Type Deprecated" as an error in Selenium?

I am using eclipse-jee-luna-SR1-win32-x86_64 for Selenium (the version of Selenium is selenium-stand-alone-2.44.0 and selenium-java-2.44.0). I get an error message 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");
        }
}
+4
source share
3 answers

The interface Seleniumand DefaultSeleniumbelong to Selenium 1 and are deprecated. Selenium switched to Selenium 2 (WebDriver), and for this reason, these warning messages are displayed to encourage users to stop using the old Selenium 1 code and start using Selenium 2 (WebDriver) code.

: IDE (Eclipse) Java.

, Selenium 2 (WebDriver). WebDriver - , Selenium 2 drivers.

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

, . RemoteWebDriver/HtmlUnitDriver/FireFoxDriver/ChromeDriver/IEDriverServer .. import Java.

Selenium selenium = new DefaultSelenium();

WebDriver driver = new TheSpecificDriver();
+5
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.firefox.FirefoxDriver;

 public class FirstTestCase {
     public static void main(String[] args) {
         WebDriver driver = new FirefoxDriver();
         driver.navigate().to("http://seleniumsimplified.com");
         driver.close();    
 }

}

0

Source: https://habr.com/ru/post/1569075/


All Articles