seleniumWebDriver的API操作顯示等待_10_5

seleniumWebDriver的API操作顯示等待_10_5

   WebDriver driver;

  

    @Test

    public void f() {

       driver.get("http://www.sogou.com");

       //顯示等待判斷當前頁面中是否包含"新聞"兩個關鍵字,若包含則執行後續測試邏輯

       BooleancontainText=(newWebDriverWait(driver, 10)).until(newExpectedCondition<Boolean>() {

          @Override

          public Booleanapply(WebDriver d){

             return d.getPageSource().contains("新聞");

          }

      });

       Assert.assertTrue(containText);

    }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章