瓦廷&谷歌搜索

发布于 2024-09-16 19:04:45 字数 245 浏览 1 评论 0原文

我正在尝试使用 Watin 来解析谷歌搜索结果。 但是 watin 无法在 Google 搜索结果页面中找到元素。当我查看源代码时,这是因为该页面是通过 javascript 生成的,因此搜索结果不会以 html 形式通过网络发送。

但是,当我打开 Firebug(在 Firefox 中)时,我能够解析由 javascript 生成的 html。

有谁知道我如何让 Watin 做同样的事情,以便我能够解析结果?

谢谢 :)

I'm trying to use Watin to parse google search results.
However watin is unable to find elements i the Google Search Result page. When I view the source it's because the page is generated off javascript so the search results are not sent over the wire in html.

However when I open up Firebug (in Firefox) I am able to parse the html that gets generated by the javascript.

Does anyone know how I can get Watin to do the same so I'm able to parse the results?

Thanks :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

兲鉂ぱ嘚淚 2024-09-23 19:04:45

您可以使用 google 搜索 API 来代替吗?

http://code.google.com/apis/ajaxsearch/documentation/#fonje< /a>

Could you use the google search API instead?

http://code.google.com/apis/ajaxsearch/documentation/#fonje

迎风吟唱 2024-09-23 19:04:45

这可能是一个时间问题。如果 javascript 正在生成数据,您可能会在写入数据之前检查数据。尝试在调试中运行它,逐步执行并等待,直到您知道源代码中存在这些项目,然后再使用 WatiN 进行测试。

我还建议发布代码,以便我们可以准确地看到您想要做什么。

It may be a matter of timing. If javascript is generating the data, you may be checking for your data before it is written. Try running it in debug, stepping through and waiting until you know the items exist in the source before using WatiN to test for it.

I would also suggest posting code so we can see exactly what you're trying to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文