python - 使用ghost.py模拟点击后访问网页内容

标签 python screen-scraping ghost.py

我正在使用 Ghost.py 模拟单击​​按钮。但无法弄清楚如何获取单击按钮后加载的内容。

from ghost import Ghost

ghost = Ghost(wait_timeout=40)
page, extra_resources = ghost.open("http://www.samsung.com/in/consumer/mobile-phone/mobile-phone/viewall")
#ghost.wait_page_loaded()
n=2;

print type(ghost.click("input#txtViewAll"))

接下来要做什么来获取动态加载的内容?

PS:在谷歌中查找,无法得到答案

提前致谢

最佳答案

我认为这应该是答案:

page, resources = ghost.evaluate(
    "document.getElementById('txtViewAll').click();", expect_loading=True)

问候,

关于python - 使用ghost.py模拟点击后访问网页内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14582186/

相关文章:

Python 网页抓取教程。连接MySQL数据库问题

php - 从 newegg 获取商品价格

python - 可以在 Heroku 上安装 PySide 或 PyQt 吗?

python - VS 代码调试器立即退出

python - continue 和 break 语句做同样的事情

python - 加载 MySQLdb 模块时出错 : No module named 'MySQLdb'

python - 使用 scrapy 管理多个爬虫

javascript - Ghost.py 通过 javascript 链接

javascript - Ghost.py - 单击特定按钮

python - xlutils 只适用于 xls,不适用于 xlsx?