2016-11-23 33 views

回答

1

您可以滾動使用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(); 

那麼高數解析爲整數。