2017-08-19 21 views
0

我想知道如何做一個「等待」,直到一些行動完成,就像我有一個啓動畫面的應用程序,我需要等待飛濺按下按鈕(「完成」),我該怎麼做?我想這一個,但給我一個錯誤:Appium,如何等待一個動作或行爲

AndroidDriver driver = capabilities(); 
     driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); 
     WebDriverWait wait = new WebDriverWait(driver, 20); 
     wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//android.widget.TextView[contains(@text,'Done')]"))); 

     driver.findElementByXPath("//android.widget.TextView[[email protected]='Done']"); 
     driver.findElementByXPath("//android.widget.TextView[[email protected]='Got it']"); 
     driver.findElementByAndroidUIAutomator("new UiScrollable(new USelector()).scrollIntoView(text(\"World Music\"));"); 
     driver.findElementByXPath("//android.widget.TextView[[email protected]='SKIP']"); 

謝謝

+0

把更多的超時在implicitlyWait。 10秒似乎很少。 –

回答

0

我得到了解決,建立一個wait方法

WebDriverWait wait = new WebDriverWait(driver, 10); 
    wait.until(ExpectedConditions.textToBePresentInElement(By.xpath("//*[@text='Done']"), "Done")); 
相關問題