0

I used this xpath locator: //table/following::div[text()='value']/preceding::span[@class='x-grid-checkcolumn'][1]"}

on the page i scripted as:

public void selectTestPlan(String value) {
            String[] path = {ChatTestingPagePath2.ChatTestManagement.TEST_PLAN_CHECKBOX[0].replace("{value}", value),ChatTestingPagePath2.ChatTestManagement.TEST_PLAN_CHECKBOX[1]};
            click(path);
        }

but it always failed, it says that it was unable to locate the element.

Hoping for your response.

Thank you!

However when changing the value in specific value like this:

//table/following::div[text()='Testing']/preceding::span[@class='x-grid-checkcolumn'][1]"}

and use the page as:

public void selectTestPlan() {
            String[] path = {ChatTestingPagePath2.ChatTestManagement.TEST_PLAN_CHECKBOX[0], value),ChatTestingPagePath2.ChatTestManagement.TEST_PLAN_CHECKBOX[1]};
            click(path);
        }

it will passed the automated test.

1 Answer 1

0

This should work:

public void selectTestPlan(String value) {

        String path = "//table/following::div[text()='%s'] preceding::span[@class='x-grid-checkcolumn'][1]";

        click(String.format(path, value));
    }

I hope it helps!

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.