1 回答
TA贡献1803条经验 获得超6个赞
要通过Selenium在网页http://jqueryui.com/resizable/中自动实现可实现的概念(拖放) ,您可以使用以下解决方案:
代码块:
System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
driver.get("http://jqueryui.com/resizable/");
driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@class='demo-frame']")));
WebElement target = new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//div[@class='ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se']")));
//dragAndDropBy(WebElement source, int xOffset, int yOffset) //status: WORKS
new Actions(driver).dragAndDropBy(target, 50, 50).build().perform();
System.out.println("Resizing of element Completed");
控制台输出:
Resizing of element Completed
浏览器快照:
添加回答
举报