【问题标题】:Python Ghost module not loading page properlyPython Ghost 模块无法正确加载页面
【发布时间】:2016-07-23 14:11:04
【问题描述】:

这是我的代码:

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 上尝试时,它可以完美运行。

【问题讨论】:

    标签: java python html session ghost


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2014-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-23
      • 1970-01-01
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      相关资源
      最近更新 更多