作者:Watts | 来源:互联网 | 2022-12-18 13:58
Scenario:Iopenwww.google.com,inputsomekeywordsandclickthesearchbutton.nowigettother
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.
场景:我打开www.google.com,输入一些关键字并点击搜索按钮。现在我进入结果页面。我想获取此结果页面的当前URL,包括查询参数。
I found a method getBrowserUrl()
here phpunit-selenium on github. Line 410
我在github上找到了一个方法getBrowserUrl(),这里是phpunit-selenium。 410行
But this method returned the value which I set in the setUp
function.
但是这个方法返回了我在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;
}
I got a string 'http://www.google.com/' instead of the whole url of result page. Please help me,thanks!
我有一个字符串'http://www.google.com/'而不是结果页面的整个网址。请帮帮我,谢谢!
5 个解决方案