After clicking on button a list of checkbox appears. I want to select a checkbox with input taken from excel sheet.

1.This the button, on click list of checkboxes appears.

enter image description here

2.The list of checkboxes.

enter image description here

DOM image:

enter image description here

  • have you done anything yourself?
    – Yu Zhang
    Commented Dec 23, 2017 at 21:38

1 Answer 1


I would provide the process to solve the problem:

  1. First find the element with the text (to be searched) on the web page. (in your case its an <a> tag).

My personal suggestion is to use xpath: //a[contains(text(),'<your text from excel>')]

  1. Then try to find its sibling input tag with type='checkbox' (either by using following-sibling or preceding-sibling on that <a> tag.

//a[contains(text(),'<your text from excel>')]/following-sibling::input[@type='checkbox']


//a[contains(text(),'<your text from excel>')]/preceding-sibling::input[@type='checkbox']

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.