问题描述
当测试失败时,运行硒测试的浏览器将关闭.这在尝试调试时无济于事.我知道我可以选择在发生故障时进行屏幕截图,但是如果没有整个上下文,那将无济于事.在浏览器仍然可用的情况下,我可以回弹并检查发生了什么.
when the tests fail, the browser that the selenium tests were running on closes. this is unhelpful when trying to debug. i know i have the option of a screen shot upon failure, but that doesn't help without the entire context. with the browser still available, i can hit back and inspect what was going on.
即使断言失败或找不到元素,有没有办法使浏览器保持打开状态?
is there a way to keep the browser open even when asserts fail or elements aren't found?
推荐答案
许多周后将其随机化.
启动服务器时,请在末尾使用-browserSessionReuse选项.这样可以在整个测试过程中保持一个浏览器会话处于打开状态,而不会在失败时关闭
when starting the server, use the option -browserSessionReuse at the end. this will keep one browser session open throughout the tests and not close on failure
这篇关于使用phpunit/selenium保持硒浏览器打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!