ghostdriver: /session/:id/phantom/execute

128 views
Skip to first unread message

John Harrison

unread,
Apr 18, 2014, 11:36:10 PM4/18/14
to phan...@googlegroups.com
Hello group,

phantomJS: 1.97
selenium: 2.41.0

I am trying to add the custom webdriver protocol extension /session/:id/phantom/execute to some third party bindings to Selenium.
I will illustrate the problem with command line curl calls.
As an example I have selenium driving phantomJS with sessionid 7eeba3dc-b54a-4192-8e55-98f15eaace57

john@ubuntu:~$ curl -X POST -H "Content-Type: application/json" -d '{"url":"http://www.google.com"}' http://localhost:4444/wd/hub/session/7eeba3dc-b54a-4192-8e55-98f15eaace57/url

correctly navigates

10:23:53.113 INFO - Executing: [get: http://www.google.com] at URL: /session/7eeba3dc-b54a-4192-8e55-98f15eaace57/url)

searching for the DOM element with name "q"

john@ubuntu:~$ curl -X POST -H "Content-Type: application/json" -d '{"using":"name", "value":"q"}' http://localhost:4444/wd/hub/session/7eeba3dc-b54a-4192-8e55-98f15eaace57/element
{"status":0,"sessionId":"7eeba3dc-b54a-4192-8e55-98f15eaace57","value":{"ELEMENT":"1"},"state":null,"class":"org.openqa.selenium.remote.Response","hCode":2089895831}

again seems to return what we would expect.

Now if I call the custom method described http://ivandemarino.me/2014/01/ghostdriver-1-1-0-codename-banquo/

john@ubuntu:~$ curl -X POST -H "Content-Type: application/json" -d '{"script":"return arguments[0] + arguments[0]", "args":[1]}' http://localhost:4444/wd/hub/session/7eeba3dc-b54a-4192-8e55-98f15eaace57/phantom/execute
john@ubuntu:~$

I am not returned anything.

john@ubuntu:~$ curl -X POST -H "Content-Type: application/json" -d '{"script":"return arguments[0] + arguments[0]", "args":[1]}' http://localhost:4444/wd/hub/session/7eeba3dc-b54a-4192-8e55-98f15eaace57/phantom/execute

Indeed the selenium server seems to ignore the command completely. I would have expected to be returned something.
Any thoughts and ideas would be greatly appreciated

John

Ivan De Marino

unread,
Apr 30, 2014, 8:33:52 PM4/30/14
to phan...@googlegroups.com
Could you please report this against https://github.com/detro/ghostdriver ? If already done so, please ignore.
Reply all
Reply to author
Forward
0 new messages