Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This project is not covered by Drupal’s security advisory policy.
Convert Selenium IDE PHP output to Drupal SimpleTest format.
To use:
- Download the Selenium IDE.
- Record a test or portion of a test.
- Export the test as PHP (File -> Export Test Case As -> PHP).
- Paste contents of exported test into conversion form (admin/config/development/simpletest_selenium).
- Copy all or part of converted test into desired SimpleTest.
For use with Drupal 6:
- Change
core = 7.x
tocore = 6.x
in the .info file. - (Optional) Change the menu path from
admin/config/development/simpletest_selenium
toadmin/configuration/simpletest_selenium
in the .module file.
For example:
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class Example extends PHPUnit_Extensions_SeleniumTestCase
{
function setUp()
{
$this->setBrowser("*chrome");
$this->setBrowserUrl("http://change-this-to-the-site-you-are-testing/");
}
function testMyTestCase()
{
$this->open("/");
$this->click("link=Privacy");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Transparency and Choice"));
$this->assertEquals("Google Privacy Center", $this->getTitle());
$this->click("link=privacy principles");
$this->waitForPageToLoad("30000");
$this->type("q", "search");
$this->click("submit");
$this->waitForPageToLoad("30000");
$this->click("link=2");
$this->waitForPageToLoad("30000");
}
}
Turns into:
// $Id$
/**
* @file
*/
class Example extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'Example',
'description' => '...',
'group' => 'Example',
);
}
protected function testExample() {
$this->drupalGet('');
$this->clickLink(t('Privacy'));
$this->assertText(t('Transparency and Choice'));
$this->assertTitle(t('Google Privacy Center'));
$this->clickLink(t('privacy principles'));
$edit = array (
'q' => 'search',
);
$this->drupalPost(NULL, $edit, t('submit'));
$this->clickLink(t('2'));
}
}
Sponsored by Clarity Digital Group (owners of NowPublic.com and Examiner.com).
Project information
- Created by boombatower on , updated
- This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.