Skip to content

Commit

Permalink
Added protected "Page::setCurrentUrl" method for extending the library.
Browse files Browse the repository at this point in the history
  • Loading branch information
aik099 committed Feb 28, 2024
1 parent 23bd19f commit f722b67
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions library/QATools/QATools/PageObject/Page.php
Expand Up @@ -123,9 +123,7 @@ public function open(array $params = array())
throw new PageException('Page url not specified', PageException::TYPE_EMPTY_URL);
}

$this->pageFactory->getSession()->visit($url);

return $this;
return $this->setCurrentUrl($url);
}

/**
Expand All @@ -145,13 +143,31 @@ public function setUrlBuilder(IBuilder $url_builder)
/**
* Returns url of the current page.
*
* Overriding this method would allow operating on a page within a frameset.
*
* @return string
*/
public function getCurrentUrl()
{
return $this->pageFactory->getSession()->getCurrentUrl();
}

/**
* Sets url of the current page.
*
* Overriding this method would allow operating on a page within a frameset.
*
* @param string $url URL.
*
* @return self
*/
protected function setCurrentUrl($url)
{
$this->pageFactory->getSession()->visit($url);

return $this;
}

/**
* Checks if the page is currently opened in browser.
*
Expand Down

0 comments on commit f722b67

Please sign in to comment.