2 Replies Latest reply on Nov 27, 2013 8:04 AM by lenno1

    NoSuchElementException occurs but element is present

    lenno1

      Hi, I'm using Arquillian with Drone/Graphene in standalone-mode for functional testing of our website(old legacy project). In some cases, after a link was clicked or a form was submitted there occurs a NoSuchElementException, but the element is definitely present. I tried several waiting conditions. The page has a table layout which completely resides in a html frame. So my first thought was to switch to the mainframe again but then I get a NoSuchFrameException (because I'm already inside the frame). Any idea why this is happening or how to fix this?

       

      @FindBy(linkText = "Startseite")

      private WebElement startPageLink;

       

           guardHttp(driver.findElement(By.partialLinkText(linkText))).click();

           guardHttp(startPageLink).click();

       

      org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"link text","selector":"Startseite"}

      Command duration or timeout: 5 milliseconds

      For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html

      Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'

      System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'

      Session ID: 48bd91fe-e395-4a2a-9852-fb2a2fd1fd4e

      Driver info: org.openqa.selenium.firefox.FirefoxDriver

      Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=25.0.1}]

      For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html

      Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'

      System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'

      Driver info: driver.version: unknown

          at org.jboss.arquillian.graphene.enricher.WebElementUtils$5.getTarget(WebElementUtils.java:124)

          at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.getTarget(GrapheneProxyHandler.java:149)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:140)

          at com.sun.proxy.$Proxy18.copy(Unknown Source)

          at org.jboss.arquillian.graphene.guard.RequestGuardFactory.guard(RequestGuardFactory.java:87)

          at org.jboss.arquillian.graphene.DefaultGrapheneRuntime.guardNoRequest(DefaultGrapheneRuntime.java:71)

          at org.jboss.arquillian.graphene.Graphene.guardNoRequest(Graphene.java:132)

          at de.neusta.arquillian.pageabstractions.ProjectOverView.chooseProject(ProjectOverView.java:43)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invokeReal(GrapheneProxyHandler.java:130)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$1.invoke(GrapheneContextualHandler.java:159)

          at org.jboss.arquillian.graphene.guard.RequestGuardFactory$1.intercept(RequestGuardFactory.java:97)

          at org.jboss.arquillian.graphene.proxy.InvocationContextImpl.invoke(InvocationContextImpl.java:87)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler$2.call(GrapheneContextualHandler.java:209)

          at org.jboss.arquillian.graphene.context.BrowserActions.performAction(BrowserActions.java:62)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:205)

          at org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.intercept(GrapheneContextualHandler.java:229)

          at de.neusta.arquillian.pageabstractions.ProjectOverView$$EnhancerByGraphene$$bb982458.chooseProject(<generated>)

          at de.neusta.arquillian.testcases.P2WTest.chooseProject(P2WTest.java:98)

          at de.neusta.arquillian.testcases.InitialCreationTest.createFirstUser(InitialCreationTest.java:86)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

          at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

          at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

          at org.jboss.arquillian.junit.Arquillian$6$1.invoke(Arquillian.java:270)

          at org.jboss.arquillian.junit.standalone.LocalTestMethodExecutor.execute(LocalTestMethodExecutor.java:53)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:606)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)

          at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.test(EventTestRunnerAdaptor.java:111)

          at org.jboss.arquillian.junit.Arquillian$6.evaluate(Arquillian.java:263)

          at org.jboss.arquillian.junit.Arquillian$4.evaluate(Arquillian.java:226)

          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

          at org.jboss.arquillian.junit.Arquillian$5.evaluate(Arquillian.java:240)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)

          at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

          at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

          at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

          at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

          at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

          at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

          at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:185)

          at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:314)

          at org.jboss.arquillian.junit.Arquillian.access$100(Arquillian.java:46)

          at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:199)

          at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

          at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:147)

          at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

          at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

          at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      Caused by: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"link text","selector":"Startseite"}

      Command duration or timeout: 5 milliseconds

      For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html

      Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'

      System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'

      Session ID: 48bd91fe-e395-4a2a-9852-fb2a2fd1fd4e

      Driver info: org.openqa.selenium.firefox.FirefoxDriver

      Capabilities [{platform=XP, databaseEnabled=true, cssSelectorsEnabled=true, javascriptEnabled=true, acceptSslCerts=true, handlesAlerts=true, browserName=firefox, browserConnectionEnabled=true, nativeEvents=true, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=25.0.1}]

          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

          at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

          at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)

          at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)

          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)

          at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:307)

          at org.openqa.selenium.remote.RemoteWebDriver.findElementByLinkText(RemoteWebDriver.java:356)

          at org.openqa.selenium.By$ByLinkText.findElement(By.java:241)

          at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:299)

          at org.jboss.arquillian.graphene.enricher.WebElementUtils.dropProxyAndFindElement(WebElementUtils.java:156)

          at org.jboss.arquillian.graphene.enricher.WebElementUtils$5.getTarget(WebElementUtils.java:122)

          ... 85 more

      Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"link text","selector":"Startseite"}

      Build info: version: '2.35.0', revision: '8df0c6bedf70ff9f22c647788f9fe9c8d22210e2', time: '2013-08-17 12:46:41'

      System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'

      Driver info: driver.version: unknown

          at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/LSCHIF~1/AppData/Local/Temp/anonymous3065525538207750925webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8880)

          at <anonymous class>.FirefoxDriver.prototype.findElement(file:///C:/Users/LSCHIF~1/AppData/Local/Temp/anonymous3065525538207750925webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8889)

          at <anonymous class>.DelayedCommand.prototype.executeInternal_/h(file:///C:/Users/LSCHIF~1/AppData/Local/Temp/anonymous3065525538207750925webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10817)

          at <anonymous class>.DelayedCommand.prototype.executeInternal_(file:///C:/Users/LSCHIF~1/AppData/Local/Temp/anonymous3065525538207750925webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10822)

          at <anonymous class>.DelayedCommand.prototype.execute/<(file:///C:/Users/LSCHIF~1/AppData/Local/Temp/anonymous3065525538207750925webdriver-profile/extensions/fxdriver@googlecode.com/components/command_processor.js:10764)