Reputation: 95
I am testing registration flow using selenium web driver. I have a field to enter email ID which shouldnt be the same as the user's emailId(user who is already registered). The code is mentioned below. I need to get the cssselector.
<em for="coworkeremail" class="error">Your co-worker's email must be different than yours</em>
Thanks Java beginner
Upvotes: 0
Views: 476
Reputation: 29042
It's a little sketchy to match on that class, especially if there are more. error
is a very generic class, so i'd say match on the for
attribute.
em.error[for='coworkeremail']
As you say in the comments, your element is in a frame. Find the ID or Name of that frame, then execute,
driver.switchTo().frame("idOrName"); // assuming you are using Selenium 2 and Java
THEN find the element.
Upvotes: 1
Reputation: 8548
Considering you only one element with class = error
.error
is the CSS selector.
Upvotes: 0