可以自动化网络搜索吗?
是否可以在网站搜索表单中输入一系列搜索?我有一个目的地列表,想看看搜索对于每个目的地是否返回结果或引发错误。
Is it possible in a website search form to enter in series of searches? I have a list of destinations and would like to see if for each destination the search returns a result or throws an error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议你看看 Watir - 它允许自动化浏览器(可能只有 IE,不确定)并且用于您所描述的工具。您可以转到指定的站点,引用页面上的 HTML 元素并设置它们的值(单击按钮、填写搜索表单等)。
它还被移植到其他几种语言中,例如 #C (WatiN) 和 Java (WatiJ) 等。
I suggest you look into Watir - it allows automating the browser(possibly only IE, not sure) and is the tool to use for what you've described. You can go to a specified site, refer to HTML elements on the page and set their values (click buttons, fill search forms, etc).
It's also been ported into several other languages, such as #C (WatiN) and Java (WatiJ) and probably more.
对于此类问题,我选择的工具是结合使用 Cucumber 和 水豚。
Cucumber 是一个很好的 DSL,用于编写此类任务,尽管对于您的问题来说并不是绝对必要的。
Capybara 是一个浏览器模拟器/驱动程序包装器,用于与网站自动交互。
两者都有详细记录。
My tool of choice for a problem like this would be to use Cucumber in combination with Capybara.
Cucumber is a nice DSL for writing out tasks such as these, although isn't strictly necessary for your problem.
Capybara is a browser simulator/driver wrapper for automated interaction with a website.
Both are well documented.