我正在使用 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/