Selenium + PHP
Introduction to Selenium Webdriver Installation and Environment set up Chrome Chrome with options Chrome in Mobile Emulation IE Firefox Element identification methods Assertions in Selenium in PHP Interacting with elements in Selenium in PHP Basic Browser window automation Sending keys in Selenium in PHP Synchronization in Selenium Check if Element exists Working with Tables using Selenium Performing advanced actions using Selenium in PHP Executing JavaScript in Selenium in PHP Working with multiple Browser Windows or tabs Working with multiple frames Handling alerts Taking a screenshot in selenium Integration with BDD framework like behatSelenium and IE in php
Below example illustrates how to launch Internet Explorer in Selenium in PHP. Make sure that protected mode settings are same for all zones in IE before running the code. Also IEDriverserver.exe file should be in PATH.
<?php
class LaunchIE extends PHPUnit_Framework_TestCase {
protected $webDriver;
public function setUp()
{
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => ‘internet explorer’);
$this->webDriver = RemoteWebDriver::create(‘https://localhost:4444/wd/hub’, $capabilities);
}
protected $url = ‘https://www.softpost.org’;
public function testTitle()
{
$this->webDriver->get($this->url);
// checking that page title contains word ‘Tutorial’
$this->assertContains(‘Tutorial’, $this->webDriver->getTitle());
}
public function tearDown()
{
//Close the browser
$this->webDriver->quit();
}
}
?>
Web development and Automation testing
solutions delivered!!