1
    public static void main(String[] args) throws InterruptedException {                            
        
    // declaration and instantiation of objects/variables       
    System.setProperty("webdriver.chrome.driver","C:\\Users\\User\\chromedriver.exe");                  
    WebDriver driver = new ChromeDriver();                  
            
    String baseUrl = "";                    
    driver.get(baseUrl);                    
    driver.manage().window().maximize();

    // Get the WebElement corresponding to the Email Address(TextField)     
    WebElement email = driver.findElement(By.id("fname"));                          

    // Get the WebElement corresponding to the Password Field       
    WebElement password = driver.findElement(By.xpath("//input[@type='password']"));    
    
    WebElement btnLogin = driver.findElement(By.xpath("//span[contains(text(),'Log in')]"));

    email.sendKeys("hansi");                    
    password.sendKeys("Hansi@123"); 
    btnLogin.click();
    Thread.sleep(2000);
    System.out.println("Text Field Set");                   
     
    Assert.assertEquals( driver.findElement(By.xpath("//div[contains(text(),'Messages')]")).getText(), "Messages");     
            
}       

}

This is the error Exception in thread "main" java.lang.Error: Unresolved compilation problem: ChromeDriver cannot be resolved to a type

at newpackage.MyClass.main(MyClass.java:16)
Nandan A
  • 2,702
  • 1
  • 12
  • 23

0 Answers0