クロールしたいWebサイトには動的にロードされる複数のページがあり、クリックをシミュレートしたい(セレンのようにブラウザを開かずに)ので、Ghost.pyを使用しています。
簡単なプログラムはこちら
from ghost import Ghost
import time
ghost = Ghost(wait_timeout=50)
page, extra_resources = ghost.open("http://www.samsung.com/in/consumer/mobile-phone/mobile-phone/viewall")
#ghost.wait_page_loaded()
n=2;
#links=ghost.evaluate("""
# alist=document.getElementsById('txtViewAll');
# alist.click;
# """)
#print type(ghost.click("input#txtViewAll"))
page1, resources = ghost.evaluate("document.getElementById('txtViewAll').click();", expect_loading=True)
time.sleep(20)
print page1
しかし
出力はNoneです。
プログラムの何が問題なのか、誰かが私を助けてくれませんか。
なぜ機能しないのですか?