0
我想在页面上的表格滚动。 我读过this answer。但它不适合我。 This is page were table presented。我如何选择它与webdriver和滚动到底部?表中的内容是可加载的。我需要这个数来计算表中有多少物品。也许存在一些其他的提示,使其更容易?如何在硒中滚动div?
我想在页面上的表格滚动。 我读过this answer。但它不适合我。 This is page were table presented。我如何选择它与webdriver和滚动到底部?表中的内容是可加载的。我需要这个数来计算表中有多少物品。也许存在一些其他的提示,使其更容易?如何在硒中滚动div?
您可以滚动使用JavaScript:
JavascriptExecutor jsExec = (JavascriptExecutor) driver;
jsExec.executeScript("document.querySelector('#gwt-debug-contentPanel > div:nth-child(2) > div > div:nth-child(2) > div > div:nth-child(3) > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(1) > div.GNHGC04CJJ').scrollTop = 500");
但要找出有一个更简单的方法数:
WebElement number = driver.findElement(By.cssSelector("#gwt-debug-contentPanel > div:nth-child(2) > div > div:nth-child(2) > div > div:nth-child(3) > div > div > div > table > tbody > tr:nth-child(1) > td:nth-child(1) > div.gwt-HTML"));
String range = number.getText();
那么高数解析为整数。