I have written a simple code to enter email in facebook login page. But while entering the email value through sendKeys i am getting validation like "The method sendKeys(String) is undefined for the type By". I have already checked the compliance version which is 1.8. So what is going wrong here??. Below is code snippet:
package SeleniumTests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class OpenFacebook {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver","geckodriver path");
WebDriver driver=new FirefoxDriver();
driver.get("http:\\facebook.com");
driver.manage().window().maximize();
driver.findElement(By.xpath("//[@id='email']").sendKeys("swarup.wipro@gmail.com");
}
}
I am getting an option of Add cast to By.xpath as a quick fix. Can somebody explain the usage of this or is there any other solution available