Unstable code

61 views
Skip to first unread message

dom...@computerlogy.com

unread,
Feb 12, 2016, 5:32:01 AM2/12/16
to Selenium Users
Hi,

Why do I get errors sometimes and other times it works.

My code is simply this:
driver.findElement(By.xpath("//section[@id='objective']/dl/dd/ul/li[2]/p")).click();

Error:
org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (557, 395). Other element would receive the click: <div class="page-loading show">...</div>
  (Session info: chrome=48.0.2564.109)
  (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.10.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 96 milliseconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'Dominics-MBP.lan', ip: '192.168.86.148', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_65'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/var/folders/nr/y6074c2s69d4ycd9y2qq48j80000gn/T/.org.chromium.Chromium.b5sLVv}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=48.0.2564.109, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 3dd6c336556c9f60a349e250bc8854fd
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:326)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
    at SocialAdsTests.ClicksConversion1.testClicksConversions(ClicksConversion1.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)


saba. s

unread,
Feb 12, 2016, 5:39:08 AM2/12/16
to seleniu...@googlegroups.com
Dominic, seems to be a timeout issue. have you used wait in your code? if not, use that either implicit or explicit( if needed)

org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (557, 395). Other element would receive the click: <div class="page-loading show">...</div>

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/38f32e4a-052a-4fb1-8057-d2cdd3f94ab5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--







Thanks,
Kanaga sabapathy.M.S.

dom...@computerlogy.com

unread,
Feb 12, 2016, 5:43:36 AM2/12/16
to Selenium Users
Yes I use Thread.sleep(3000)

Nikhil Srivastava

unread,
Feb 13, 2016, 10:36:51 AM2/13/16
to seleniu...@googlegroups.com
Hi Dominic,

Just increase the wait time little bit more. 

This is generally happens when element not attached with the page and Webdriver try to finds it. 

Thanks,
Nikhil

Anand Somani

unread,
Feb 13, 2016, 11:20:30 AM2/13/16
to seleniu...@googlegroups.com
Error message directly pointing there is page-loading show image on top of other element. So you add explicit wait as below 

public void explicitWaitUntilInvisibilityOfPageLoader() {

try {

WebDriverWait wait = new WebDriverWait(driver, explicitWaitTimeout);

wait.until(ExpectedConditions.invisibilityOfElementLocated(By.xpath("//div[@class='page-loading show']")));

} catch (TimeoutException e) {

Assert.fail("Unable to load Page Loading on Page due in " + explicitWaitTimeout + " sec due to Error : " + e.getMessage());

}

}


Thanks & Regards,
Anand Somani
Refer myBlogs: http://seleniumtestingguide.blogspot.in/


Anand Somani

unread,
Feb 13, 2016, 11:23:48 AM2/13/16
to seleniu...@googlegroups.com
This error is not because element is not attached to DOM.
If element is not attached to DOM completely then you will get StaleElementReferenceException exception.

Thanks & Regards,
Anand Somani
Refer myBlogs: http://seleniumtestingguide.blogspot.in/
On 13 February 2016 at 21:05, Nikhil Srivastava <nikh...@gmail.com> wrote:

Nikhil Srivastava

unread,
Feb 14, 2016, 12:41:03 AM2/14/16
to seleniu...@googlegroups.com
Yes, Anand you are correct. I was also saying same thing.

"This is generally happens when element not attached with the page and Webdriver try to finds it." (Because page was not loaded completely when webdriver was looking for Element).

Thanks anyways.

Regards,
Nikhil

dom...@computerlogy.com

unread,
Feb 14, 2016, 2:28:42 AM2/14/16
to Selenium Users
Thanks Anand.  Up until now I have just been usuing Thread.sleep (20000)

Shawn Conlin

unread,
Feb 14, 2016, 10:02:08 AM2/14/16
to Selenium Users
I recently encountered this error and was able to determine it was caused by a dropdown menu being triggered while attempting to click an item located just below it on the page. This was happening as a result of the screen resolution in use on the test machine, but was also related to the Selenium version. I rolled Selenium back from 2.51.1 to 2.45.0 the issue resolved. I haven't had a chance to follow up to figure out why the newer version is more resolution sensitive.
Reply all
Reply to author
Forward
0 new messages