Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteWebDriver.findElement() returns null #5809

Closed
kool79 opened this issue Apr 19, 2018 · 4 comments
Closed

RemoteWebDriver.findElement() returns null #5809

kool79 opened this issue Apr 19, 2018 · 4 comments
Labels

Comments

@kool79
Copy link

kool79 commented Apr 19, 2018

Selenium Version: v 3.8.1 (java bindings)

I use RemoteWebDriver (connected to chomedriver) which is wrapped by EventFiringWebDriver.

My stacktrace shows NPE with stacktrace

Caused by: java.lang.NullPointerException:
	at org.openqa.selenium.support.events.EventFiringWebDriver.extractInterfaces(EventFiringWebDriver.java:124)
	at org.openqa.selenium.support.events.EventFiringWebDriver.access$500(EventFiringWebDriver.java:69)
	at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.<init>(EventFiringWebDriver.java:368)
	at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.<init>(EventFiringWebDriver.java:360)
	at org.openqa.selenium.support.events.EventFiringWebDriver.createWebElement(EventFiringWebDriver.java:311)
	at org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:194)
.....

NPE was caused by line

extractInterfaces(allInterfaces, object.getClass());

in EventFiringWebDriver.extractInterfaces(). When I analyzed chain of calls I found that object should be the WebElement which is returned by

 WebElement temp = driver.findElement(by);

by EventFiringWebDriver.findElement(). Here driver is instance of RemoteWebDriver.

I know that actually it is chromedriver issue. But there are very similar issues here (for findElements() ) which were fixed at client side, see #4555 and #4375.

Extra info:
In my case I tried to wait until element in another window will dissapear (by scenario window should be closed after click 'pay' button) So I expected that findElement will throw StaleElementException, ElementNotFoundException or NoSuchWindowException but I got NPE instead.
Subsequent call to webdriver returned:
org.openqa.selenium.NoSuchWindowException: no such window: target window already closed from unknown error: web view not found (Session info: chrome=63.0.3239.108) (Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 6.1.7601 SP1 x86_64) ....

@barancev
Copy link
Member

For issues please provide a concise reproducible test case and describe what results you are seeing and what results you expect.

See CONTRIBUTING.md

@barancev
Copy link
Member

Also retest in the latest version (that is 3.11 at the moment)

@kool79
Copy link
Author

kool79 commented Apr 20, 2018

Retested on 3.11 - have the same issue

I cannot give you reproducible testcase which works well because issue occurred rarely (I have 2 fails in the same place in code for > 200 executions of data-driven test)

Can we have some workaround for this? Like you did for findElements in 4a3ec2d when fixing #4555. For example, throw NotFoundException or some other exception when remote driver returns null for findElement ?

@Karengrigoryan060
Copy link

Hi all.
Can someone help to find workaround for this?

@lock lock bot locked and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants