Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to enter data '[email protected]' at Email field but I'm getting the error mentioned on title/subject.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.gmail.com");
    ((WebElement)driver.findElements(By.name("Email"))).sendKeys("[email protected]");
share|improve this question

2 Answers 2

findElements returns java.util.List<WebElement>, not WebElement. Maybe you wanted to use findElement (without s), which returns a single WebElement.

share|improve this answer
    
Thanks Joachim. –  Arihant Sankhla Feb 3 at 13:19

use driver.findElement (it will return single element)

instead of

driver.findElements (It will return list)

share|improve this answer
    
as I already wrote:) –  Joachim Feb 3 at 13:18
    
I am sorry. I didn't see your answer. –  Debmalya Biswas Feb 3 at 13:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.