0

I want to click number of checkbox which is generated dynamically. How to perform that task? please help. Given Below is the Xpath sequence of the checkbox

//*[@id="220077552"]/td[1]/app-checkbox/label

//*[@id="220219925"]/td[1]/app-checkbox/label

//*[@id="220077552"]/td[1]/app-checkbox/label

each time this id is generated automatically.
What should be used to find the element?

I tried this code below

 WaitUtils.waitForDataToLoad(getDriver());
        List<WebElement> memberSelection = getDriver().findElements(By.cssSelector(".form-checkbox.notext"));
        for(int count =1;  count<=10; count++){
            memberSelection.get(count).click();
        }
3
  • 1
    Did you try anything? If you did post your code and explain what was the problem with it. Commented Nov 1, 2018 at 8:12
  • 2
    Hello, please attach html and code samples. We cannot guess what you have done so far! Commented Nov 1, 2018 at 8:26
  • @Guy I have posted the code I tried Commented Nov 16, 2018 at 5:53

1 Answer 1

1

You can make use of XPath functions like starts-with, contains or ends-with.

Sample code looks like:

//*[starts-with(@id, '220')]
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.