The following code snippet is used to scroll horizontally within a web page:
WebElement element=driver.findElement(By.xpath("//div[@class='table-wrapper']"));
JavascriptExecutor js=(JavascriptExecutor)driver;
js.executeScript("arguments[0].scrollLeft=arguments[0].scrollWidth", element);
During debugging at the third step, the executeScript
function returned a value of "null".
Although the Xpath is correct and the element is being located successfully, I am unable to identify the specific locator for the scroll functionality. Therefore, I have resorted to using the entire Xpath for the particular div: //div[@class='table-wrapper']
.