Here is what inspect element option in chrome
has found.
<input class="buttonstylenormal margin-top5" type="submit" value="Sign In" onclick="return isFirstClick()">
It is not having ID
in it, which would have made my work easier. All I have now is class
, value
and type
. With these I am not able to click the button Sign In
.
Please help me with the right code to click this button.
You can use XPath
, as @jainish said, or try to use CssSelector
, that uses the same syntax that CSS has to apply styles.
To find it using CssSelector
, you can use a few variations:
driver.findElement(By.cssSelector("input[type='submit']"))
or
driver.findElement(By.cssSelector("input.buttonstylenormal.margin-top5"))
or
driver.findElement(By.cssSelector("input.buttonstylenormal.margin-top5[type='submit']"))
CssSelector
may help you even in other elements you'd like to find that do not have an ID.
Hope it's somehow helpful.
Try this below xpath.
Explanation: Use value
attribute of input
tag.
//input[@value='Sign In']
OR
Explanation: Use class
and value
attribute of input
tag.
//input[@class='buttonstylenormal margin-top5'][@value='Sign In']
OR
Explanation: Use class
and type
attribute of input
tag.
//input[@class='buttonstylenormal margin-top5'][@type='submit']
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.