HTML looks like below :
<button class="btn btn-primary pull-right" type="submit">Sign in</button>
There are multiple buttons with same class and type value. However I need to click only Sign in button using CSS selector. I tried the following but none of them is working
@FindBy(how=How.CSS, using="button:contains('Sign in')") WebElement signInButton;
@FindBy(how=How.CSS, using=".btn btn-primary pull-right[text='Sign in']") WebElement signInButton;
Also point me to some complex CSS selector examples site.
A CSS selector doesn't support text evaluation. Use an XPath instead:
@FindBy(how=How.XPATH, using="//button[text()='Sign in']")
WebElement signInButton;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With