I am trying to run a software in Eclipse but failed facing the following errors.
Exception in thread "main" java.lang.Error: Unresolved compilation problems: WebDriver cannot be resolved to a type ChromeDriver cannot be resolved to a type WebElement cannot be resolved to a type By cannot be resolved. Can anyone help me working this problem?
I am trying to open a website for testing purpose through selenium webdrive. The software I am working with are:
- selenium 3.13.0
- eclipse 4.12.0
- javac 1.8.0_221
- Chrome 77.0.3865.90 (Official Build) (64-bit)
package Cross_browser_test;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.*;
public class Facebook_Login {
//public
/**
* @param args
*/
public static void main(String[] args) {
// Optional. If not specified, WebDriver searches the PATH for chromedriver.
WebDriver driver;
System.setProperty("webdriver.chrome.driver", "C:\\webdriver\\cromedriver.exe");
driver = new ChromeDriver();
driver.get("http://www.google.com/");
Thread.sleep(5000); // Let the user actually see something!
WebElement searchBox = driver.findElement(By.name("q"));
searchBox.sendKeys("ChromeDriver");
searchBox.submit();
Thread.sleep(5000); // Let the user actually see something!
driver.quit();
}
}