facebook/php-webdriver — Issue #12: execute() does not work?
Author: ildar-aim
Created: 2011-12-02 11:16:53+00:00
State: open

The problem is
print_r($session->execute('return "test_js"')); does not output nothing. The expected result is string "test_js"
according to
http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/execute

script code
-----------
session('firefox'); // firefox is default
$session->open('http://xcart53.crtdev.local/~aim/t.html');
print_r($session->execute('return "test_js";'));

echo "done\n";
die;
?>
-----------
Where the
http://xcart53.crtdev.local/~aim/t.html is any html page.

There are outputs
------------
[15:13][aim@kde170-green:pts/4][~/tmp/del]$ php index.php
done
[15:13][aim@kde170-green:pts/4][~/tmp/del]$
------------

[15:13][aim@kde170-green:pts/1][~/tmp/del]$ java -jar selenium-server-standalone-2.14.0.jar
02.12.2011 14:13:20 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
14:13:21.019 INFO - Java: Sun Microsystems Inc. 19.0-b09
14:13:21.022 INFO - OS: Linux 3.0.0 i386
14:13:21.055 INFO - v2.14.0, with Core v2.14.0. Built from revision 14955
14:13:22.056 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
14:13:22.058 INFO - Version Jetty/5.1.x
14:13:22.059 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
14:13:22.060 INFO - Started HttpContext[/selenium-server,/selenium-server]
14:13:22.060 INFO - Started HttpContext[/,/]
14:13:22.110 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1b3f8f6
14:13:22.110 INFO - Started HttpContext[/wd,/wd]
14:13:22.117 INFO - Started SocketListener on 0.0.0.0:4444
14:13:22.117 INFO - Started org.openqa.jetty.jetty.Server@77158a
14:13:33.319 INFO - Executing: [new session: {browserName=firefox}] at URL: /session)
14:13:38.177 INFO - Done: /session
14:13:38.183 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@1bb326c at URL: /session/1322824401418)
14:13:38.183 INFO - Done: /session/1322824401418
14:13:38.185 INFO - WebDriver remote server: Fatal, unhandled exception: /session/1322824401418: java.util.concurrent.ExecutionException: java.lang.NullPointerException
14:13:38.186 WARN - EXCEPTION
javax.servlet.ServletException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:590)
at org.openqa.selenium.remote.server.DriverServlet.doGet(DriverServlet.java:516)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:490)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:139)
at org.openqa.selenium.remote.server.handler.WebDriverHandler.execute(WebDriverHandler.java:90)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:226)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:586)
... 16 more
Caused by: java.lang.NullPointerException
at org.openqa.selenium.remote.server.renderer.ForwardResult.render(ForwardResult.java:39)
at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:221)
at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
14:13:38.193 WARN - /wd/hub/session/1322824401418:
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:139)
at org.openqa.selenium.remote.server.handler.WebDriverHandler.execute(WebDriverHandler.java:90)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:226)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:586)
at org.openqa.selenium.remote.server.DriverServlet.doGet(DriverServlet.java:516)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:490)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.lang.NullPointerException
at org.openqa.selenium.remote.server.renderer.ForwardResult.render(ForwardResult.java:39)
at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:221)
at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
14:13:38.201 INFO - Executing: [get: http://xcart53.crtdev.local/~aim/t.html] at URL: /session/1322824401418/url)
14:13:39.657 INFO - Done: /session/1322824401418/url