2017-02-21 8 views
0

私のテストは2月20日より前に正常に実行されていました。この日の午前からは、コンソールに多数のエラーが表示されます。彼らは次のようになります:ExpectedConditionsクラスは、セレンテストの実行中に多数のエラーをスローする

лют. 21, 2017 2:38:19 PM org.openqa.selenium.support.ui.ExpectedConditions findElement 
WARNING: WebDriverException thrown by findElement(By.xpath: //a[@href='/#/activities']//span) 
org.openqa.selenium.NoSuchElementException: Cannot locate an element using By.xpath: //a[@href='/#/activities']//span 
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html 
Build info: version: '3.1.0', revision: 'b94c902', time: '2017-02-16 12:21:31 -0800' 
System info: host: 'SALSALABS5', ip: '192.168.15.114', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111' 
Driver info: driver.version: unknown 
    at org.openqa.selenium.support.ui.ExpectedConditions.lambda$findElement$0(ExpectedConditions.java:896) 
    at java.util.Optional.orElseThrow(Optional.java:290) 
    at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:895) 
    at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:41) 
    at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:181) 
    at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:178) 
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:234) 
    at com.vitalii.vitaliiFramework2.helpers.Waiters.fluentWaitIgnoringNoSuchElementExceptionAndElementNotVisibleException(Waiters.java:85) 
    at com.vitalii.vitaliiFramework2.pages.DashboardPage.goToActivitiesPage(DashboardPage.java:20) 
    at com.vitalii.vitaliiFramework2.tests.LoginPageTestsWD.doSuccessfulLoginTest(LoginPageTestsWD.java:19) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 

これは明らかにExpectedConditionsクラスのためです。

プロジェクトは正常に完了し、IDEはどのクラスにもエラーを表示しません。この問題は、テストの実行中にのみ確認され、常にある時点でテストが失敗します。

ブラウザまたは自分のpom.xmlを更新しませんでした。週末前は大丈夫だったし、今は失敗する。

ブラウザ - FF 47.0 セレン - ExpectedConditionsクラスを使用しています私のコードの3.1.0

例は次のとおりです。

public void fluentWaitIgnoringNoSuchElementExceptionAndElementNotVisibleException(final String locator){ 
     long waitingTime = 30; 
     long pollingInterval = 500; 
     Wait<WebDriver> wait = new FluentWait<WebDriver>(driver) 
       .withTimeout(waitingTime, TimeUnit.SECONDS) 
       .pollingEvery(pollingInterval, TimeUnit.MILLISECONDS) 
       .ignoring(NoSuchElementException.class) 
       .ignoring(ElementNotVisibleException.class) 
       .withMessage("Fluent wait of " + waitingTime + " seconds with " + pollingInterval + " milliseconds polling interval was unable to locate element with locator " + locator); 
     wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(locator))); 
    } 
+0

-changesあなたは 'ExpectedConditions'があなたのコード内で使用するの例を投稿することができますか? – Guy

+0

@Guy説明にコードを追加しました。ありがとう –

答えて

0

おめでとうございます!あなたはちょうどバグをキャッチ! ;)

私はExpectedConditionsに何も問題はないと思うが、ページのhtmlにいくつかの変更がある可能性が高い。

私はFFで手動でテストケースをチェックして、変更内容を確認します。

+0

その100%アプリケーションではありません。私はFluentWaitsをテストで使用し、テストはある時点まで続けています。コンソールでは、前述のエラーは実行時に連続して(1秒に1回だけ)スローされています。 –

0

簡単な修正では、セレンのバージョンを3.1.0から3.0.1にダウングレードしていました。

関連する問題