phpunit-selenium icon indicating copy to clipboard operation
phpunit-selenium copied to clipboard

Update Selenium RC start method to take a WebDriver session ID for WebDriverBackedSelenium support

Open daluu opened this issue 13 years ago • 5 comments

See the following for background:

https://groups.google.com/forum/?fromgroups#!topic/selenium-users/6E53jIIT0TE

http://seleniumhq.wordpress.com/2012/02/08/announcing-selenium-2-19-the-prancing-unicorn-release/

Selenium server now includes the WebDriverBackedSelenium functionality of WebDriver as part of server that any language binding can use. But to use it requires use of some WebDriver code (via this project's Selenium 2 bindings, or the other PHP WebDriver bindings) to start up WebDriver browser session then pass that session to Selenium RC code/bindings to work with via the old RC API but using WebDriver "underneath".

I think it would be helpful to the community to have PHP support for this new server side functionality. For those not yet ready to migrate to WebDriver API.

I assume this hasn't been implemented yet. If already done, ignore and close this issue.

Suggested changes for this issue:

  • modify Selenium RC start() method to support input for WebDriver session ID (per referenced thread post, in python it would be like "sel.start(driver=driver)" )
  • maybe modify or offer additional class/method for Selenium 2 bindings in this project for use with WebDriverBackedSelenium server side feature. That is don't use Selenium2TestCase as a test case but starter code to instantiate WebDriver session then pass to SeleniumTestCase (RC version) to work with as RC test case.

The start method change alone would allow use of the other PHP WebDriver bindings with PHPUnit-Selenium (RC) for WebDriverBackedSelenium. The other suggested change is to do the same thing with single project code base rather than integrate with the other PHP bindings.

daluu avatar Jun 13 '12 17:06 daluu

To use this then, I would assume users would put in some specific code in test setUp() and also specify in the browser array to use '*webdriver' instead of the other browsers, and the actual browser choice is started/specified in the WebDriver specific code during setUp, etc.

daluu avatar Jun 13 '12 17:06 daluu

Something like:

$this->setBrowser('*webdriver');
$this->setWebDriverOptions(array(
    'browser' => 'firefox',
    'browserUrl' => 'http://...'
));

This could create a new WebDriver session internally. It is probably not going to work with session reuse.

giorgiosironi avatar Jun 15 '12 08:06 giorgiosironi

Note: using the Selenium2TestCase_Driver object is going to require PHP 5.3, but should not be mandatory for who uses SeleniumTestCase but not WebDriver.

giorgiosironi avatar Jun 15 '12 08:06 giorgiosironi

@daluu: the test is there, but this implementation crashes Firefox. Do you know how to fix it?

giorgiosironi avatar Jul 02 '12 09:07 giorgiosironi

Sorry @giorgiosironi, I don't know. But I'll take a look sometime when I get a chance. Maybe an integration issue on how we pass/call the WebDriver session. I haven't tested it but it's supposed to work for Python, so would assume it should work for PHP somehow, must be broken somewhere.

I wonder if this works for IE, or is it FF only.

daluu avatar Jul 02 '12 17:07 daluu