我正在学习使用 python 2.7 和 ghost.py 进行一些网络抓取,我搜索ghost.py
了很多,但我发现很少有文档或使用帮助,这让我在学习 ghost.py 时遇到了困难。
我在下面写了一个小脚本来尝试向星巴克香港商店定位器发送查询:
ghost.open('http://www.starbucks.com.hk/store-locator/search') #1
ghost.wait_for_selector('input[name=searchField]') #2
ghost.fill("#searchForm", {'searchField': 'Tsuen Wan'}) #3
ghost.fire_on("#searchForm", #4
"button button_search", #5
expect_loading=True) #6
ghost.wait_for_selector('#searchResults') #7
ghost.evaluate("document.getElementById('searchResults')") #8
我知道代码在做什么#1-3
,但是从 开始#4
,我开始感到困惑,我不确定应该为 的第二个参数输入什么fire_on
。该脚本当前给了我一条错误消息Unable to load requested page
。
我对javascript没有经验,这会给我带来很多麻烦吗?
任何人都可以在ghost.py上给我一些启发吗?还是我应该转而使用其他东西?