I am trying to enter data 'tutorial@gmail.com' 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("tutorial@gmail.com");
findElements
returns java.util.List<WebElement>
, not WebElement
. Maybe you wanted to use findElement
(without s
), which returns a single WebElement
.
use driver.findElement
(it will return single element)
instead of
driver.findElements
(It will return list)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.