paypal / SeLion

Enabling Test Automation in Java
http://selion.io
Apache License 2.0
281 stars 233 forks source link

SeLion unable to run with runLocally=true #130

Closed renelux closed 9 years ago

renelux commented 9 years ago

When running locally with is runLocally=true isElementPresent will always throw an exception. This error is related to the change in runLocally.

    @Test
    @WebTest
    public void test() {
        Grid.open("http://www.paypal.com");
        Label label = new Label("css=#am-i-visible");

        label.isElementPresent();
        label.isVisible();
    }
renelux commented 9 years ago

Stacktrace:

FAILED: test
org.openqa.selenium.WebDriverException: <html>
<head>
<title>Error 500 Expecting non-static method org.openqa.selenium.remote.ErrorCodes.toState(I)Ljava/lang/String;</title>
</head>
<body>
<h2>HTTP ERROR: 500</h2><pre>Expecting non-static method org.openqa.selenium.remote.ErrorCodes.toState(I)Ljava/lang/String;</pre>
<p>RequestURI=/wd/hub/session/5143f591-32af-4f60-90d9-0fd9f05891d8/element</p>
<p><i><small><a href="http://jetty.mortbay.org">Powered by Jetty://</a></small></i></p>

</body>
</html>
Command duration or timeout: 1.23 seconds
Build info: version: '2.46.0', revision: '61506a4624b13675f24581e453592342b7485d71', time: '2015-06-04 10:22:50'
System info: host: 'LM-SHC-00950786', ip: '10.225.88.170', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.4', java.version: '1.7.0_75'
*** Element info: {Using=css selector, value=#am-i-visible}
Session ID: 5143f591-32af-4f60-90d9-0fd9f05891d8
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{platform=MAC, javascriptEnabled=true, acceptSslCerts=true, browserName=firefox, rotatable=false, locationContextEnabled=true, webdriver.remote.sessionid=5143f591-32af-4f60-90d9-0fd9f05891d8, version=28.0, databaseEnabled=true, cssSelectorsEnabled=true, handlesAlerts=true, browserConnectionEnabled=true, nativeEvents=false, webStorageEnabled=true, applicationCacheEnabled=true, takesScreenshot=true}]
    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:204)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:605)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:358)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:447)
    at org.openqa.selenium.By$ByCssSelector.findElement(By.java:426)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:350)
    at com.paypal.selion.platform.html.support.HtmlElementUtils.locateElement(HtmlElementUtils.java:63)
    at com.paypal.selion.platform.html.AbstractElement.getElement(AbstractElement.java:103)
    at com.paypal.selion.platform.html.AbstractElement.isElementPresent(AbstractElement.java:278)
    at com.paypal.test.e2e.SeLion.test(SeLion.java:17)
    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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
pearlselvan commented 9 years ago

Hi ,

Please use the Button button = new Button ("css=#am-i-visible") instead Label label = new Label("css=#am-i-visible"); ..because no label component available in home page : http://paypal.com

ysecaran commented 9 years ago

@renelux Can you help reproducing the issue? I am not able to with the latest code in develop.

mach6 commented 9 years ago

@renelux Hi Rene, I don't see how this could be related to the changes to runLocally.. Rather, I suspect it is something else.. Can you try downgrading back to Selenium 2.45.0 for instance?

much like @ysecaran I'm unable to reproduce this.

renelux commented 9 years ago

I just heard back from some team members and they resolved it by adding the selenium-server dependency to our POM.

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>2.46.0</version>
</dependency>
mach6 commented 9 years ago

@renelux yes. As things stand now, you need to add the selenium-server dependency if you expect SeLion client to spin up a local hub + node which is what happens when runLocally=true