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

时间:2016-04-04 06:26:19

标签: java python html session ghost

这是我的代码:

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上试用它时它完美无缺。

1 个答案:

答案 0 :(得分:0)

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