清除 selenium HTML 测试之间的 cookie?
我正在使用 selenium-server 2.2 运行 HTML 测试:
java -jar /var/lib/selenium/selenium-server.jar -ensureCleanSession -htmlSuite *firefox http://$HOST ./test/selenium/html/TestSuite.html ./target/selenium/html/TestSuiteResults .html
由于某种原因,我似乎无法在测试套件中的各个测试之间清除 cookie。我可以做些什么来清除测试之间的cookie吗?
I'm running my HTML tests as such with selenium-server 2.2:java -jar /var/lib/selenium/selenium-server.jar -ensureCleanSession -htmlSuite *firefox http://$HOST ./test/selenium/html/TestSuite.html ./target/selenium/html/TestSuiteResults.html
For some reason, I can't seem to get cookies to clear between individual tests in a test suite. Is there anything I can do to clear cookies between tests?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许我过于简单化了,但是如果您知道运行测试的域(并且需要清除其中的 cookie),您可以使用 selenium.deleteAllVisibleCookies(); 作为迭代之间的最终和初始测试条件。
Maybe I am over-simplifying, but if you are aware of the domain in which your tests are running (and in turn, need to clear the cookies off them), you could use
selenium.deleteAllVisibleCookies();
as your final and initial test condition, between iterations.