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

JavaScript execution timeout improvements #458

Closed
filipcynarski opened this issue Dec 21, 2016 · 2 comments
Closed

JavaScript execution timeout improvements #458

filipcynarski opened this issue Dec 21, 2016 · 2 comments
Milestone

Comments

@filipcynarski
Copy link
Member

@kutzi had an issue where we were doing something like
js.executeScript("arguments[0].click()", find(SELECTOR_POPUP_CLOSE_BUTTON).first().getElement());

That seemed to have stopped because of Lazy Locators (BTW: it was hanging forever! Is there some way to make it fail (fast)?)

@kutzi
Copy link
Contributor

kutzi commented Dec 21, 2016

FYI that's the thread dump of where it's hanging:

10:09:32 "Test worker" #11 prio=5 os_prio=0 tid=0x00007f123122f800 nid=0x32ca runnable [0x00007f11fa2ff000]
10:09:32    java.lang.Thread.State: RUNNABLE
10:09:32         at org.openqa.selenium.remote.internal.WebElementToJsonConverter.apply(WebElementToJsonConverter.java:50)
10:09:32         at com.google.common.collect.Iterators$8.transform(Iterators.java:799)
10:09:32         at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
10:09:32         at com.google.common.collect.Iterators.addAll(Iterators.java:362)
10:09:32         at com.google.common.collect.Lists.newArrayList(Lists.java:160)
10:09:32         at com.google.common.collect.Lists.newArrayList(Lists.java:144)
10:09:32         at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:535)
10:09:32         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:09:32         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
10:09:32         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
10:09:32         at java.lang.reflect.Method.invoke(Method.java:498)
10:09:32         at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:103)
10:09:32         at com.sun.proxy.$Proxy299.executeScript(Unknown Source)
10:09:32         at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:216)

@filipcynarski filipcynarski added this to the 3.2 milestone Jan 13, 2017
@filipcynarski
Copy link
Member Author

@kutzi I've tried to reproduce the issue and it doesn't occur.

What I'm seeing on your example is you are using your own JS executor. Could you please executeScript method from FluentLenium? It should do that work for you :)

 String script = "arguments[0].click()";
        FluentJavascript fluentJavascript = executeScript(script, find(".notExistingOne").first().getElement());

I'm adding a unit test to our integration tests suite.

The test fails quickly w/ following error, which is expected:

org.openqa.selenium.NoSuchElementException: Element By.cssSelector: .notExistingOne (first) (Lazy Element) is not present
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'MP19779.home', ip: '192.168.10.4', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: '1.8.0_111'
Driver info: driver.version: FluentDriver

	at org.fluentlenium.core.domain.ElementUtils.noSuchElementException(ElementUtils.java:25)
	at org.fluentlenium.core.proxy.AbstractLocatorHandler.noSuchElement(AbstractLocatorHandler.java:167)
	at org.fluentlenium.core.proxy.ComponentHandler.getLocatorResultImpl(ComponentHandler.java:73)
	at org.fluentlenium.core.proxy.ComponentHandler.getLocatorResultImpl(ComponentHandler.java:17)
	at org.fluentlenium.core.proxy.AbstractLocatorHandler.getLocatorResult(AbstractLocatorHandler.java:140)
	at org.fluentlenium.core.proxy.AbstractLocatorHandler.now(AbstractLocatorHandler.java:235)
	at org.fluentlenium.core.script.FluentJavascript.loadElements(FluentJavascript.java:44)
	at org.fluentlenium.core.script.FluentJavascript.<init>(FluentJavascript.java:26)
	at org.fluentlenium.core.FluentDriver.executeScript(FluentDriver.java:324)
	at org.fluentlenium.core.inject.ContainerFluentControl.executeScript(ContainerFluentControl.java:20)
	at org.fluentlenium.adapter.FluentAdapter.executeScript(FluentAdapter.java:51)
	at org.fluentlenium.integration.JavascriptTest.shouldExecuteScriptOnNotExistingElement(JavascriptTest.java:64)
	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:498)
	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.fluentlenium.integration.util.adapter.FluentTestRule$1.evaluate(FluentTestRule.java:44)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	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.fluentlenium.integration.util.adapter.FluentTest$2$1.evaluate(FluentTest.java:55)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	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:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

filipcynarski added a commit that referenced this issue Jan 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants