javascript - invoking onclick event with beautifulsoup python -


i trying fetch links accomodations in cyprus website: http://www.zoover.nl/cyprus

so far can retrieve first 15 shown. have invoke click on "volgende"-link. don't know how , in source code not able track down function called use e.g. sth posted here: issues invoking "on click event" on html page using beautiful soup in python

i need step "clicking" happens can fetch next 15 links , on.

does know how help? already!

edit:

my code looks now:

def getzooverlinks(country):     zooverweb = "http://www.zoover.nl/"     url = zooverweb + country     parsedzooverweb = parseurl(url)     driver = webdriver.firefox()     driver.get(url)      button = driver.find_element_by_class_name("next")     links = []     page in xrange(1,3):         item in parsedzooverweb.find_all(attrs={'class': 'blue2'}):             link in item.find_all('a'):                 newlink = zooverweb + link.get('href')                 links.append(newlink)         button.click()' 

and following error:

selenium.common.exceptions.staleelementreferenceexception: message: element no longer attached dom stacktrace: @ fxdriver.cache.getelementat (resource://fxdriver/modules/web-element-cache.js:8956) @ utils.getelementat (file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/t/tmpkfl43_/extensions/fxdriver@googlecode.com/components/command-processor.js:8546) @ fxdriver.preconditions.visible (file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/t/tmpkfl43_/extensions/fxdriver@googlecode.com/components/command-processor.js:9585) @ delayedcommand.prototype.checkpreconditions_ (file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/t/tmpkfl43_/extensions/fxdriver@googlecode.com/components/command-processor.js:12257) @ delayedcommand.prototype.executeinternal_/h (file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/t/tmpkfl43_/extensions/fxdriver@googlecode.com/components/command-processor.js:12274) @ delayedcommand.prototype.executeinternal_ (file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/t/tmpkfl43_/extensions/fxdriver@googlecode.com/components/command-processor.js:12279) @ delayedcommand.prototype.execute/< (file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/t/tmpkfl43_/extensions/fxdriver@googlecode.com/components/command-processor.js:12221)

i'm confused :/

while might tempting try using beautifulsoup's evaluatejavascript method, in end beautifulsoup parser rather interactive web browsing client.

you should consider solving selenium, briefly shown in this answer. there pretty python bindings available selenium.

you use selenium find element , click it, , pass page on beautifulsoup, , use existing code fetch links.

alternatively, use javascript that's listed in onclick handler. pulled source: entityquery('ns=ppopularityscore%7c1&no=30&props=15292&dims=530&as=&n=0+3+10500915');. no parameter increments 15 each page, props has me guessing. i'd recommend not getting this, though, , interact website client would, using selenium. that's more robust changes on side, well.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -