0

I am trying to click the CSS below

html body.FormBackground form#LookupForm div#Panel1 table tbody tr td div#GridContainerDiv div table#DataGrid tbody tr.GridSelectedRow td.GridRow

So far I have tried

@FindBy(css = "#DataGrid\\tbody\\tr.GridSelectedRow > td.GridRow")

and

@FindBy(css = "#DataGrid tbody tr.GridSelectedRow > td.GridRow")

But neither of the above attempts seem to work. HTML is below.

<tbody>
 <tr ondblclick="$HRnet('DataGrid').dblClick(); " gender_id="f6611f8a-8e80-41e6-a14c-fa8e25be3065" class="GridUnSelectedRow">
    <td class="GridRow">Female</td>
 </tr>
 <tr ondblclick="$HRnet('DataGrid').dblClick(); " gender_id="3ef09fb8-4d5d-43d2-abc0-2506616ef83e" class="GridSelectedRow">
    <td class="GridRow">Male</td>
 </tr>
 <tr nofocus="true">
    <td>&nbsp;</td>
 </tr>
</tbody>
6
  • can you please post the complete HTML code for the table.That will help us to get more details on the problem. Commented Jul 8, 2016 at 10:41
  • if you want to click the td of selected row then use the below css, @FindBy(css = "#DataGrid tr.GridSelectedRow > td.GridRow") Commented Jul 8, 2016 at 10:47
  • Do I have to specify if I want it to select male or female? And if so how do I do that through CSS? Commented Jul 8, 2016 at 10:57
  • Which element are you trying to click? Commented Jul 8, 2016 at 16:06
  • I would suggest you spend some time reading some tutorials on CSS and trying more things. This is at least the second question like this that you've asked recently. If you don't learn how to do this yourself, you are going to have to ask every time you run into something like this. Here's a couple links to get you started but there are million more on the web. w3.org/TR/selectors/#selectors saucelabs.com/resources/selenium/css-selectors Commented Jul 8, 2016 at 16:08

1 Answer 1

1

Based on what you've shared it looks like this should work but it will return multiple rows so you'll need to decide which one you want to click

@FindBy(css = "#DataGrid td.GridRow")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.