1
有誰知道如何使用Web驅動程序和常規觸發鼠標滾輪事件。我已經附上了我希望能夠向下滾動100 pix的代碼,任何人都可以顯示能夠做到這一點的代碼?如何用JavaScript使用groovy和webdriver在Firefox中觸發鼠標滾輪事件?
package Check
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
class Fourth {
//FirefoxDriver driver;
static main(args) {
def FirefoxDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.uk/search?q=dreams")
//Code to allow web page to be scrolled needs to be inserted here
sleep(5000);
driver.quit();
}
}