Ruby Mechanize:点击链接
在 Mechanize on Ruby 中,我必须为我访问的每个新页面分配一个新变量。例如:
page2 = page1.link_with(:text => "Continue").click
page3 = page2.link_with(:text => "About").click
...etc
是否有一种方法可以在不使用保存每个页面状态的变量的情况下运行 Mechanize?喜欢
my_only_page.link_with(:text => "Continue").click!
my_only_page.link_with(:text => "About").click!
In Mechanize on Ruby, I have to assign a new variable to every new page I come to. For example:
page2 = page1.link_with(:text => "Continue").click
page3 = page2.link_with(:text => "About").click
...etc
Is there a way to run Mechanize without a variable holding every page state? like
my_only_page.link_with(:text => "Continue").click!
my_only_page.link_with(:text => "About").click!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道我是否正确理解你的问题,但如果这是动态循环大量页面并处理它们的问题,你可以这样做:
I don't know if I understand your question correctly, but if it's a matter of looping through a lot of pages dynamically and process them, you could do it like this: