PHPUnit和WebDriver - 如何获取当前URL?

Cob*_*aBJ 7 selenium phpunit

场景:我打开www.google.com,输入一些关键字并点击搜索按钮.现在我进入结果页面.我想获取此结果页面的当前URL,包括查询参数.

我发现了一个方法,getBrowserUrl()这里在GitHub上PHPUnit的硒.410行

但是这个方法返回了我在setUp函数中设置的值.

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;
}
Run Code Online (Sandbox Code Playgroud)

我收到了一个字符串' http://www.google.com/ '而不是结果页的整个网址.请帮帮我,谢谢!

Cob*_*aBJ 14

答案是:

$currentURL = $this->url();
Run Code Online (Sandbox Code Playgroud)

我也在这里问过这个问题

感谢@jaruzafa