I am learning to use python 2.7 and ghost.py to do some web scraping, I googled ghost.py
a lot but I found very little documentation or help on use it, which gives my a bumpy ride when learning ghost.py.
I wrote a little script below to try send a query to starbucks hong kong store locator:
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
I know what the code is doing for #1-3
, but starting from #4
, I start to get confused, I am not sure what should be entered for the second parameters of fire_on
. The script currently gives me an error message of Unable to load requested page
.
I have no experience on javascript, will this cause me lots of trouble?
Can anyone enlighten me a bit on ghost.py? or should I turn to use something else?