Reputation: 89
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
Upvotes: 1
Views: 2435
Reputation: 193078
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();
Upvotes: 2