ExpectedConditions class throws numerous errors when running selenium test

February 21, 2017, at 9:43 PM

My test used to run fine prior to February 20th. Starting from the morning of this day I see numerous errors in a console. They look like:

лют. 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: '', 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)

Obviously this is because of ExpectedConditions class.

Project is complied successfully and my IDE does not show any errors in any class. The issue is only observed during tests' run-time and always causes test to fail at some point.

I did not update browser OR my pom.xml. It was fine before weekend and fails now.

Browser - FF 47.0 Selenium - 3.1.0

Example of my code that uses ExpectedConditions class is:

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)
                .withMessage("Fluent wait of " + waitingTime + " seconds with " + pollingInterval + " milliseconds polling interval was unable to locate element with locator " + locator);
Answer 1

Congratulation! You just caught a bug! ;)

I think there is nothing wrong with ExpectedConditions, but more likely there are some changes in the html of the page.

I would check the test case manually on FF to see what have changed.

Answer 2

Easy fix for this was downgrading selenium version from 3.1.0 to 3.0.1.

Monetdb query cancelling

Monetdb query cancelling

I am using Monetdb in a java application via the JDBC driverI need to cancel long running queries, or queries that are no longer relevant

GraphStream fill in a shape/polygon made of nodes

GraphStream fill in a shape/polygon made of nodes

I created several nodes and added edges between them using GraphStream in JavaI want to fill in the shape/polygon created by these nodes and edges with a color

Alfresco not able to convert large pdf image file to txt format using Tesseract

Alfresco not able to convert large pdf image file to txt format using Tesseract

I am converting pDF image file to text format using tesseract in Alfresco, but its only converting small size files completely, and for large size files its partially converting the filr from pdf to text

AWS EC2 Task/Service container with java command in the container definitions

AWS EC2 Task/Service container with java command in the container definitions

We need to deploy a docker container on AWS EC2, Hawkbit and RabbitMQ will be running on the containerWe tried to put the java command in the command section of the container definitions, when setting up our task placement