gpt4 book ai didi

java - Python Ghost 模块无法正确加载页面

转载 作者:行者123 更新时间:2023-11-28 02:57:21 24 4
gpt4 key购买 nike

这是我的代码:

from ghost import Ghost

import time,sys,os

url="http://www.endclothing.com/au/valentino-rockrunner-sneaker-ky0s0723-dnc-0ac.html"

gh=Ghost()

session=gh.start()

try:

page_resource=session.open(url,timeout=999)

except Exception as e:

print "Major error has occurred, cant load webpage!"

print e

raw_input("PRESS ENTER TO EXIT!")

sys.exit()

session.wait_for_page_loaded()

session.capture_to("preview.jpg")

try:

os.startfile("preview.jpg")

except Exception:

print "Cant look at preview"

现在,每当我查看预览时,页面都没有正确加载。我到处搜索试图找出问题所在,但我找不到解决方案。不过,当我在 www.google.com 上尝试时,它工作得很好。

最佳答案

ghost 模块不加载 javascript。另一个与此类似的有用模块是 Selenium。

关于java - Python Ghost 模块无法正确加载页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36395815/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com