bundle exec cucumber features/products.feature
使用此命令我正在运行我的产品功能 cucumber 测试 对于所有场景,但在一个场景执行后会抛出错误
Given I am an authenticated user #features/step_definitions/login.rb:37
stale element reference: element is not attached to the page document
(Session info: chrome=46.0.2490.80)
(Driver info: chromedriver=2.13.307650 (feffe1dd547ee7b5c16d38784cd0cd679dfd7850),platform=Mac OS X 10.8.5 x86_64) (Selenium::WebDriver::Error::StaleElementReferenceError)
用于身份验证。但是,如果我一个一个地运行它就会成功。请帮助如何在异常情况下同时运行所有场景。
最佳答案
如果您在页面上寻找尚未加载或过期的元素,则会出现此错误,因为 dom 在上一步中已更改。确保当您批量运行测试用例时,每个用例都应该与其他用例隔离。如果没有添加额外的步骤以确保它加载到那里,您应该检查您想要交互的元素是否在页面上。
关于ruby-on-rails-4 - 使用 Rails 4 的 cucumber 测试抛出错误 : element is not attached to the page document,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33434182/