0

I'm new to selenium and I'm trying to create a test which will verify if an element will get displayed after clicking a checkbox from a pop-up window.

Here's my code:

    public void getHeaderControl()
    {
        WorklistPageElements wp = new WorklistPageElements(driver);
        wp.getHeaderControl().click();
        Assert.assertTrue(wp.getHeaderControl().isEnabled());
        WebElement table = driver.findElement(By.id("worklistContent"));

        List<WebElement> allControls = table.findElements(By.className("studyListPanelTR"));

        for (WebElement row : allControls) {
            row.findElements(By.xpath("./*"));
            System.out.println(row.getText());
            row.click();
            //here, I'm thinking of putting an assertion to verify if an element get displayed within the page
        }
    }

Not sure though how should I do that. Thanks for the help in advance. :)

2
  • Make sure you add a tag for the programming language you are using... looks like Java. You know how to add asserts because you have one up on line 3... just add another assertTrue() for element displayed on the line you have your comment. What's the issue? Commented Jan 21, 2020 at 4:37
  • Current behavior of the system is: I clicked on a button and it will display a pop-up window that contains list of features with corresponding checkboxes. When I tick the checkbox, it is enabling the respective feature (getting displayed). The above for loop clicks on every checkbox but not yet checking if the corresponding feature is getting enabled in the screen. That's what I'm trying to do. To check/verify if the feature will get enabled whenever the system clicked on the checkbox. Commented Jan 21, 2020 at 5:57

1 Answer 1

0

you can use element.isDisplayed() method

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.