PHPUnit and WebDriver - How to get the current URL?
phpunit, selenium
Solution
The answer is:
$currentURL = $this->url();
I also asked this question here
Thanks to @jaruzafa
Problem
Scenario: I open www.google.com, input some keywords and click the search button. now i get to the result page. I want to get the current url of this result page, including the query parameters. I found a method `getBrowserUrl()` here phpunit-selenium on github. Line 410 But this method returned the value which I set in the `setUp` function. ``` public function setUp(){ $this->setBrowser(testConfig::$browserName); $this->setBrowserUrl('http://www.google.com/'); } public function testGoogleSearch(){ $this->url(''); //input some keywords ....... //click search button ....... //want to get the url of result page $resultUrl= $this->getBrowserUrl(); echo $resultUrl; } ``` I got a string 'http://www.google.com/' instead of the whole url of result page. Please help me,thanks!