Capybara selecting root node rather than specified node

我怕爱的太早我们不能终老 提交于 2019-12-24 02:43:08

问题


When running locally, the code works as expected, but when running on CI server (circle CI) it behaves strangely.

I call the #find method passing in a css selector, this normally returns the specific DOM node or throws an error.

card = find('.card__title', text: display_name).ancestor('.card')
expect(card).to have_no_selector('.read')

On the CI server, it doesn't throw an error, rather the variable card has the value of:

#<Capybara::Node::Element tag="html" path="/HTML">

and the expectations fails, as it would if I wrote:

card = find(:xpath, '/html')

For the record, the return value of

card = find('.card__title', text: display_name).ancestor('.card')

On my local is:

#<Capybara::Node::Element
  tag="article"
  path="/HTML/BODY/DIV[1]/DIV[2]/DIV[2]/DIV/ARTICLE[3]">

What can possibly cause this behavior?

来源:https://stackoverflow.com/questions/54138364/capybara-selecting-root-node-rather-than-specified-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!