Structure
PageObj
--Base
----Page
----CategoryPage
----SectionPage
--Category
--Section
--Landing
tests/phpunit
Pom
--Category
--Landing
--MegaNav
--Section
Base Class
- $driver property
- __construct() to instantiate the WebDriver
- common driver functions
<?php
namespace Src\Pom\PageObj\Base;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\DesiredCapabilities;
abstract class Page
{
/**
*
* @var RemoteWebDriver
*/
protected $driver;
public function __construct(RemoteWebDriver $driver)
{
$this->driver = $driver;
}
public function driverQuit(){
$this->driver->quit();
}
public function getPageUrl(): string {
return $this->driver->getCurrentURL();
}
public function visitUrl($url)
{
$this->driver->get($url);
}
}
Extends Base Class
[ClassName]PageObj Class
const <ELEMENT_NAME>_<SELECTORTYPE> = "id_or_name_or_css_or_xpath_or_etc";
const LANDING_LINK_HOME_XPATH = //a[@id='homelink'];
Useage
$this->driver->findElement(WebDriverBy::xapth(CategoryMarketCommentaryPageObjs::LANDING_LINK_HOME_XPATH ))->click();
- Log in to post comments
Tags
