Reputation: 1
HTML :
<input class="button" type="submit" value="Log In">
Code : This is the code of selenium. WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Log In']"))); driver.findElement(By.xpath("//input[@value='Log In']")).click();
I have to click this input
Upvotes: 0
Views: 501
Reputation: 29362
Your xpath is wrong
this
input[@value='Log In']
should be
//input[@value='Log In']
Like this
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Log In']")));
driver.findElement(By.xpath("//input[@value='Log In']")).click();
//input
selects all input
elements in a document
. Please read about it here
Upvotes: 0