为什么我收到此错误?
undefined method `map' for true:TrueClass
Did you mean? tap (NoMethodError)
在浏览器中检查成功。
执行此xpath :
page.find(:xpath, './/td[contains(., "Total Income:")]/following-sibling::td[2]//text()="£ 0.00"')
我试图剖析它,
这样做没有问题:page.find(:xpath, './/td[contains(., "Total Income:")]')
使用following-sibling
答案 0 :(得分:0)
你得到它是因为你的XPath没有返回元素,而是返回XPath
.//td[contains(., "Total Income:")]/following-sibling::td[2]//text()="£ 0.00"
返回一个布尔值(text()="£ 0.00"
的结果)。目前还不能确切地确定你想要抓住哪个元素 - 而是
page.find(:xpath, './/td[contains(., "Total Income:")]/following-sibling::td[2]//*[text()="£ 0.00"'])
可能是你想要做的。
顺便说一下 - 你和Capybara一起使用的是哪个司机?