【selenium自动化】第三篇,常用方法

天蓝Sea

关注

阅读 81

2022-04-06

#最大化窗口
webDriver.manage().window().fullscreen();
#向前
webDriver.navigate().back();

    /**
    多个窗口之间切换
     */
    Set<String> windowHandles = webDriver.getWindowHandles();
    webDriver.switchTo().window(windowHandles.toArray()[0].toString());
    
    /**
     悬停
     */
    WebElement tj_settingicon = webDriver.findElement(By.id("s-usersetting-top"));
    Actions action =new Actions(webDriver);
   方式1:action.clickAndHold(tj_settingicon).perform();
   方式2:action.moveToElement(tj_settingicon).perform();

精彩评论(0)

0 0 举报