How to pass capabilities when using PHP binding

475 views
Skip to first unread message

JS

unread,
Jan 8, 2013, 6:11:04 PM1/8/13
to seleniu...@googlegroups.com
When using a php binding such as Facebook's https://github.com/facebook/php-webdriver or the one used by Mink http://mink.behat.org/, how can desired capabilities be passed ?

For example, 
after starting the standalone server using java -jar standalone.jar, I launch a php script with a simple capability array, such as platform => VISTA, which gets json_encoded by the php binding and sent to selenium. However however the capabilities returned by selenium do not reflect the change. In /wd/hub, all my sessions  systematically have the same set of capabilities and I cannot alter or add to them.

Any idea ?

Using standalone server version 2.28

Thanks in advance

Jim Evans

unread,
Jan 8, 2013, 6:22:38 PM1/8/13
to seleniu...@googlegroups.com
The desired capabilities you're requesting from the server are just that: "desired". The server is under no obligation to supply them to you. :) That's why you get a capabilities object back, so you can tell what capabilities the session *actually* has. I would assume that the server is unable to give you the exact capabilities you've asked for, and is giving you its best attempt at fulfilling your request.

JS

unread,
Jan 8, 2013, 9:54:56 PM1/8/13
to seleniu...@googlegroups.com
Ok, thanks.

Well in my particular case, I'm trying to pass the proxy capability, i can't seem to be able to make it work. Basically I'm trying to do this http://seleniumhq.org/docs/04_webdriver_advanced.jsp#using-a-proxy but through a php binding. Whatever I try, the server never returns a proxy capability. Is it an expected behavior ?

Simon Stewart

unread,
Jan 9, 2013, 5:52:34 AM1/9/13
to seleniu...@googlegroups.com
The server never returns the proxy capability: it'll just tell you which APIs it supports.

Simon

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/TFNAIv7EXkEJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

JS

unread,
Jan 9, 2013, 10:25:06 AM1/9/13
to seleniu...@googlegroups.com
what are the capabilities that are listed in /wd/hub for each sessions ? I'm really confused now ...

Crawling101

unread,
Jan 30, 2014, 4:50:17 PM1/30/14
to seleniu...@googlegroups.com
Hi There, 

I'm not able to get proxy settings on php bindings provided by  https://github.com/facebook/php-webdriver

it returns a blank page while // navigate to 'http://docs.seleniumhq.org/'


with this settings

$host = 'http://localhost:4444/wd/hub'; // this is the default //$wd_host = 'http://localhost:4444/wd/hub';  
$capabilities = array(
        WebDriverCapabilityType::BROWSER_NAME=> WebDriverBrowserType::HTMLUNIT 
      , WebDriverCapabilityType::PROXY =>  array('proxyType' => 'manual', 'httpProxy' =>  '17*.*.*.183', 'sslProxy' => '17*.*.*.183')
       );//
$driver = RemoteWebDriver::create( $host ,$capabilities); 



RESULT is :
<?xml version="1.0" encoding="UTF-8"?>
<html>
  <head/>
  <body/>
</html>

about:blankArray
(
)
The title is '
The current URI is about:blank'

David

unread,
Feb 2, 2014, 4:33:52 PM2/2/14
to seleniu...@googlegroups.com
Can you try it with another language binding as well to see what happens?

Best thing to do is capture the JSONWire request from the binding (PHP vs other language using RemoteWebDriver) and the response returned by the Selenium server. Then see if there is any difference. It could be a problem with the PHP binding if not with Selenium, or how you've constructed the request in PHP.

Unless things have changed, the Facebook PHP driver main project wiki shows different syntax for desired capabilities. Perhpas there's no more convenience code to help you construct it. It would be good for you or someone to update the wiki for any changes/enhancements to specifying desired capabilities.


David

unread,
Feb 2, 2014, 4:34:48 PM2/2/14
to seleniu...@googlegroups.com
Forgot to mention that you would capture the request using a network snifer or proxy like Fiddler2, Charles, Wireshark.
Reply all
Reply to author
Forward
0 new messages