0

Hi, I want to b able to click on a check box based on a value. Below is the html of the same:

<tbody>
<tr>
    <th>Record Type</th>
    <th style="text-align:center">Has Access?</th>
    <th style="text-align:center">Can Create?</th>
    <th style="text-align:center">Can Read All Records?</th>
</tr>
<tr>
    <td>
        <input id="ORMW.S2.0.Object Type" class="readOnlyField" type="text"      value="Account" maxlength="255" size="25" name="ORMW.S2.0.Object Type" readonly="readonly"/>
    </td>
    <td align="center">
        <input id="ORMW.S2.0.Has Access_VP123456" type="checkbox" onclick="cbValue(this,'ORMW.S2.0.Has\x20Access');" style="margin-left:0px;margin-top:1px;height:10px;width:10px;vertical-align:middle"/>
        <input id="ORMW.S2.0.Has Access" type="hidden" value="Y" tabindex="-1"   name="ORMW.S2.0.Has Access"/>
    </td>
    <td align="center">
    <td align="center">

I want to click on checkbox based on the value account here.

2
  • Please post what you have tried. Commented May 14, 2014 at 9:27
  • i hv tried this : //input[@type='checkbox']/preceding::td/input[@type='text' and @value='Account' ] but its selecting account not th checkbox Commented May 14, 2014 at 9:30

2 Answers 2

1

Next query will search element by @value='Account' then traverse up to the first tr and then search your checkbox:

//input[@type='text' and @value='Account']/ancestor::tr[1]//input[@type='checkbox']
Sign up to request clarification or add additional context in comments.

Comments

0

you can also try this:

//input[@type='checkbox' and preceding-sibling::input[@type='text' and @value='Account']]

1 Comment

thnx nitin ..but it didnt wrk for me

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.