Quality Testing

Quality is delighting customers

Selenium-Click on check box using stored variable

Hi ,

I have stuck in the middle of selenium

I need to click on check box which is followed by name.
But in page 1, will enter name and store in a variable called variable name.
In page 2, i have so many names followed by check boxes.

here my question is can i click on the particular name which i added recently.

here code goes for page 1 text field variable:

<input id="Name_0" class="textbox" type="text" value="" maxlength="200" name="Name">

and in page 2, for check box and name which is as follows.

<div class="legend_col">
<input id="12345" class="checkbox" type="checkbox" value="12345" name="idArray[]">

<div class="input_col">
<a id="12345" class="title all-names" href="" name="all-names">Name</a>

now my question is  how can i click on check box for the name i have entered recently by using variable name.

I would be great full for the solution..

If i use below command, i am able to select either name or either first check box in the page.

command: click
name="idArray[ ---------------------- im able to click on first check box.

command : click
Target:  //a[contains(text(),'${
Variable name}')]

can you please help me out in selecting particular element to check....?

Thanks in advance,

Views: 274

Reply to This

Replies to This Discussion

can u get the x-path of that element?? if so it can be easy to check it

ya i got the xpath... but my doubt is im unable to check the check box..


can i include variable name in xpath??? cz i thnk xpath is only used to find the element..

Share the screen with teamviewer, will let u know the solution.


TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service