简体   繁体   English

如何用黄瓜测试jQuery验证错误消息?

[英]How Can I test jQuery validation error msgs with cucumber?

I googled around and I found this: https://gist.github.com/1056822 我用Google搜索了一下,我发现了这个: https//gist.github.com/1056822

However, once I put it into my project I got this: 但是,一旦我把它放入我的项目,我得到了这个:

Unable to find xpath <XPath::Union:0x106cfc928 @expressions=[

<XPath::Expression::Where:0x106d026c0 @left=#<XPath::Expression::Where:0x106d02bc0 @left=

<XPath::Expression::Descendant:0x106d1e960 @left=., @expressions=[

<XPath::Expression::Literal:0x106d02d50 @expression=:input>, 

<XPath::Expression::Literal:0x106d02d28 @expression=:textarea>..... and it goes on

Can anyone tell me how jQuery validation is supposed to be test with cucumber? 谁能告诉我jQuery验证应该用黄瓜测试?

Thanks 谢谢

尝试只查找错误消息...我相信语法是

Then I should see "<your error message text>"

As jaydel said, you can just use Then I should see "whatever". 正如杰德尔所说,你可以使用Then I should see "whatever".

If you want to use XPath, try checking out W3School's XPath page: http://www.w3schools.com/xpath/xpath_syntax.asp 如果您想使用XPath,请尝试查看W3School的XPath页面: http//www.w3schools.com/xpath/xpath_syntax.asp

You should only really be using XPath if you want to dig deep in to the DOM and do very specific stuff that simply doing I should see doesn't support. 你应该只是真正使用XPath,如果你想深入挖掘DOM并做一些非常具体的事情, I should see它不支持。

You can also try looking up Capybara's rdoc (http://rdoc.info/github/jnicklas/capybara/master/frames) if you want to write something custom. 如果你想写一些自定义的东西,你也可以尝试查找Capybara的rdoc(http://rdoc.info/github/jnicklas/capybara/master/frames)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM