Selenium advanced operations in php

Below example shows how to perform complex actions using Selenium in PHP like drag and drop, moving to element, double clicking on an element, right clicking on an element etc.
class MyTest extends PHPUnit_Framework_TestCase {

protected $webDriver;

public function setUp()
$capabilities = array(WebDriverCapabilityType::BROWSER_NAME => ‘chrome’);
$this->webDriver = RemoteWebDriver::create(‘https://localhost:4444/wd/hub’, $capabilities);

public function testActions()

$e1 = $this->webDriver->findElement(WebDriverBy::id(‘fn’));
$e2 = $this->webDriver->findElement(WebDriverBy::linkText(‘Selenium in Java’));

$action = new WebDriverActions($this->webDriver);
//Similarly you can perform below actions.
//clickAndHold(), contextClick(), doubleClick()
//dragAndDrop(), dragAndDropBy(), moveByOffset(), moveToElement()
//keyDown(), keyUp(), release(), sendKeys()


public function tearDown()
//Quit the driver

Web development and Automation testing

solutions delivered!!