1

I am using selenium java and have to get values from an ag-grid table that dynamically loads values when we scroll top to bottom or left to right. As of now, we are using JavaScriptExecutor to scroll the table and get the values.

Is there any other effective approach that can be used for getting the values without scrolling the table?

Please find a sample ag-grid table below, https://www.ag-grid.com/example.php

1 Answer 1

2

There are two pottential alteranitives against the usage of JavaScriptExecutor to scroll as follows:

  • the first alternative would be to use the WebDriverWait with ExpectedConditions elementToBeClickable() which scrolls the WebElement within the Viewport by default. As an example:

    new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.id("birtviewer")));
    
  • The other alternative would be to use the moveToElement​(WebElement target) as follows:

    WebElement myElement = driver.findElement(By.linkText("link"));
    new Actions(driver).moveToElement(myElement).build().perform();
    
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.