Hi,
1. When I run the same piece of code as present in #1318, I get NPE in line
WebElement form = browser.findElements(By.tagName("form")).get(1);
I've run code in debugger, and found that selenium don't wait for page to load in previous line
and tries to find elements while page is not loaded yet.
But that's not the only problem!
2. I've added Thread.sleep(10000) after get(url) to wait for page explicitly -- and NPE is still here!
After short exploration I've found that findElements just returns null everytime, even if I call browser.findElements(By.tagName("body")) or browser.findElements(By.xpath("//body")).
Call to browser.findElement(By.tagName("body")) or browser.findElement(By.xpath("//body")) gives the following stack trace:
Exception in thread "main" org.openqa.selenium.WebDriverException: Unable to find element with tag name == body (WARNING: The server did not provide any stacktrace information)
System info:
os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_24'
Driver info: driver.version: RemoteWebDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:131)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:105)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:409)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:192)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByTagName(RemoteWebDriver.java:233)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:184)
at demo.Experiment.main(Experiment.java:21)
I've checked IE8 and IE9 (both on Windows 7), selenium 2.0b3 and trunk -- with the same result.
What's that? Do anybody have success with IE?
Regards,
Alexei Barantsev
Software-Testing.Ru