Reputation: 57
What locator can i use for the below:
<button class="buttonLeftEnabled floatLeft" type="submit"><span>Continue</span></button>
Upvotes: 0
Views: 663
Reputation: 506
To locate the Continue button, you can use:
driver.findElement(By.xpath("//button[@type='submit']").click();
OR
driver.findElement(By.xpath("//button[@contains(text(),'Continue')]").click();
Hope this helps.
Upvotes: 3
Reputation: 193088
To locate the button with text as Continue you can use either of the following solutions:
cssSelector
:
WebElement elem = driver.findElement(By.cssSelector("button.buttonLeftEnabled.floatLeft>span")).click();
xpath
:
WebElement elem = driver.findElement(By.xpath("//button[@class='buttonLeftEnabled floatLeft']/span[contains(.,'Continue')]")).click();
Upvotes: 0