第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

FluentWait類型不是通用的;通過Selenium和Java無法為FluentWait類的參數(shù)

FluentWait類型不是通用的;通過Selenium和Java無法為FluentWait類的參數(shù)

狐的傳說 2019-12-06 15:49:16
我正在與Selenium Standalone Server 3.0.1。我正在嘗試向Explicit Wait代碼中添加,以在元素可見時通過xpath檢測元素。為了獲得一些Java幫助,我尋找了源代碼, Selenium Standalone Server 3.0.1但找不到它。我在selenium-java-2.53.1發(fā)行版中找到了源代碼。我下載并找到selenium-java-2.53.1-srcs并添加到我的Eclipse IDE。在的幫助下FluentWait,我只需將代碼復(fù)制粘貼到我的代碼中,Eclipse IDE然后更改變量名。文檔中的示例代碼如下:   // Waiting 30 seconds for an element to be present on the page, checking   // for its presence once every 5 seconds.    Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)       .withTimeout(30, SECONDS)       .pollingEvery(5, SECONDS)       .ignoring(NoSuchElementException.class);    WebElement foo = wait.until(new Function<WebDriver, WebElement>() {     public WebElement apply(WebDriver driver) {       return driver.findElement(By.id("foo"));      }    });但是,當我實現(xiàn)此代碼時,只需復(fù)制粘貼即可:       Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)           .withTimeout(30, TimeUnit.SECONDS)           .pollingEvery(5, TimeUnit.SECONDS)           .ignoring(NoSuchElementException.class);       WebElement element = wait.until(new Function<WebDriver, WebElement>()        {         public WebElement apply(WebDriver driver) {           return driver.findElement(By.xpath("//p[text()='WebDriver']"));         }       });我在FluentWaitClass 上遇到錯誤The type FluentWait is not generic; it cannot be parameterized with arguments <WebDriver>這是我的進口清單:    import java.util.concurrent.TimeUnit;    import org.apache.log4j.Logger;    import org.apache.log4j.PropertyConfigurator;    import org.openqa.selenium.By;    import org.openqa.selenium.NoSuchElementException;    import org.openqa.selenium.WebDriver;    import org.openqa.selenium.WebElement;    import org.openqa.selenium.chrome.ChromeDriver;    import org.openqa.selenium.support.ui.Wait;    import com.google.common.base.Function;有人可以幫我嗎?
查看完整描述

3 回答

?
冉冉說

TA貢獻1877條經(jīng)驗 獲得超1個贊

最簡單的解決方案是使用其他方法實現(xiàn):


withTimeout(Duration.ofSeconds(10))

            .pollingEvery(Duration.ofSeconds(2))

該表格withTimeout(Duration timeOut) 仍在使用,不建議使用


查看完整回答
反對 回復(fù) 2019-12-06
  • 3 回答
  • 0 關(guān)注
  • 1002 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號