简体   繁体   English

如何在黄瓜步骤中用锚访问路径?

[英]How to visit path with anchor in Cucumber step?

I need to check the link, that is not on the page. 我需要检查链接,该链接不在页面上。 I should follow some path with existed anchor (#check, for example). 我应该使用已有的锚点(例如#check)走一些路。 How can I do this? 我怎样才能做到这一点?

Thanks a lot! 非常感谢!

You have not given much details about your problem, but from this scarce information you've supplied I conclude that you're doing something naughty. 您没有提供有关您的问题的太多详细信息,但是从您提供的这些稀缺信息中,我得出的结论是您正在做一些顽皮的事情。

This is because while writing acceptance or integration tests with Cucumber you should have no need for 'checking a link that's not on a page'. 这是因为在使用Cucumber编写验收或集成测试时,您无需“检查页面上没有的链接”。

Anyways, you haven't mentioned what framework you're using with Cucumber . 无论如何,您都没有提到Cucumber使用什么框架。 Assuming you're using Capybara , you can define a step like this: 假设您正在使用Capybara ,则可以定义如下步骤:

And /^Invis is doing something naughty right now $/ do
  @some_thing = SomeThing.first 
  visit hidden_link_with_anchor_path(@some_thing, :anchor => "foo" )
end

Hope that helps. 希望能有所帮助。

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

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