What am I messing up

package Testsel3;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class Classel3 {

public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "C:\\Users\\xyz's 
Laptop\\Chromerdriver\\chromedriver.exe");
    WebDriver driver = new ChromeDriver(); 

    driver.get("https://www.gmail.com");
    driver.manage().window().maximize(); 
    driver.findElement(By.id("identifierId")).sendKeys("xyz@gmail.com");

} 

}

When I try to run the above script I get an error saying: Multiple markers at this line - The method sendKeys(CharSequence...) from the type WebElement refers to the missing type CharSequence

  • The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files

1 answer

  • answered 2018-11-08 04:11 Duncan Krebs

    If you get the above error message in Eclipse IDE then you must be using Java version 8 java JDK 8. In JDK 8 the CharSequence Class have new default methods as compared to previous JDKs causing this issue.

    Quick Fix Try this:

    driver1.findElement(By.id("aa")).sendKeys(new String[] {"xx"});

    so it does not use CharSequence, seems like you are using a newer JDK version than what Selenium that was compiled against. You could also try the following.

    1. Right click on project go to java compiler settings and lower compliance level to 1.5
    2. Download newer version of selenium jars.