yandex-qatools / htmlelements

Html Elements is a Java framework providing easy-to-use way of interaction with web-page elements in web-page tests.
Other
271 stars 116 forks source link

Prevent NullPointerException when webdriver.timeouts.implicitlywait=0 #141

Closed leonsabr closed 7 years ago

leonsabr commented 7 years ago

I don't want to implicitly wait for some element to appear on the page. So I set -Dwebdriver.timeouts.implicitlywait=0 and get

java.lang.NullPointerException
    at ru.yandex.qatools.htmlelements.loader.decorator.proxyhandlers.WebElementNamedProxyHandler.invoke(WebElementNamedProxyHandler.java:50)
    at com.sun.proxy.$Proxy43.isDisplayed(Unknown Source)
    at ru.yandex.qatools.htmlelements.element.HtmlElement.exists(HtmlElement.java:98)

After this change method should be invoked at least ones.

Also fixed a typo lasException -> lastException.

Also fixed a test. Test order is random and depends on JVM, I got a failed test because another test changed webdriver.timeouts.implicitlywait property value and didn't restore it.

artkoshelev commented 7 years ago

Thanks, merged.