如何解决如何在Selenium中的open之前创建cookie
| 此代码仅适用于* googlechrome。$this->browserBot->setCommandLineFlags(\'commandLineFlags=--disable-web-security\');
$this->browserBot->setBrowser(\'*googlechrome\');
$this->browserBot->setHost(\'localhost\');
$this->browserBot->setPort(4444);
$this->browserBot->setBrowserUrl(\'http://example.com\');
$this->browserBot->start();
$this->browserBot->createCookie(\'foo=bar\',\'path=/; domain=.example.com\');
$this->browserBot->open(\'http://example.com/print_cookie.php\');
在* firefox和* iexplore中仅适用于以下情况:
$this->browserBot->start();
$this->browserBot->open(\'http://example.com/blank_page.html\');
$this->browserBot->createCookie(\'foo=bar\',\'path=/; domain=.example.com\');
$this->browserBot->open(\'http://example.com/print_cookie.php\');
我可以在* firefox等中的open()之前(没有多余的open()调用)创建cookie吗?
解决方法
这一切都取决于每次注入浏览器的内容。
您记录的第二种方法是我要执行的方法,以确保它可以在多个浏览器版本上工作。我不认为您可以为每种浏览器做第一种方法。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。