我想取的联系,从这个网站在塞浦路斯的全部住宿onclick事件: http://www.zoover.nl/cyprus调用与beautifulsoup蟒蛇
到目前为止,我可以检索其已经显示了前15。所以现在我必须调用点击“volgende”链接。不过,我不知道该怎么做,并且在源代码中,我无法追踪被调用的函数,例如, ......喜欢张贴在这里: Issues with invoking "on click event" on the html page using beautiful soup in Python
我只需要发生“点击”的步骤,因此我可以获取下15个链接等。
有人知道如何提供帮助吗? 已经感谢!
编辑:
我的代码看起来像现在这样:
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 = []
for page in xrange(1,3):
for item in parsedZooverWeb.find_all(attrs={'class': 'blue2'}):
for link in item.find_all('a'):
newLink = zooverWeb + link.get('href')
links.append(newLink)
button.click()'
,我得到以下错误:
selenium.common.exceptions.StaleElementReferenceException:消息:元素不再连接到DOM Stacktrace: at fxdriver.cache.getElementAt(resource://fxdriver/modules/web-element-cache.js:8956) at Utils.getElementAt(file:/// var/folders/n4/fhvh qlmx23s8ppxbrxrpws3c0000gn/T/tmpKFL43_/extensions/[email protected]/components/command-processor.js:8546) at fxdriver.preconditions.visible(file:/// var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/T/tmpKFL43_/extensions /[email protected]/components/command-processor.js:9585) at DelayedCommand.prototype.checkPreconditions_(file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/T/tmpKFL43_/extensions/[email protected]/ components/command-processor.js:12257) at DelayedCommand.prototype.executeInternal_/h(file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/T/tmpKFL43_/extensions/[email protected]/components/command-processor .js:12274) at DelayedCommand.prototype.executeInternal_(file:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/T/tmpKFL43_/extensions/[email protected]/components/command-processor.js:12279) 在DelayedCommand.prototype.execute/<(文件:///var/folders/n4/fhvhqlmx23s8ppxbrxrpws3c0000gn/T/tmpKFL43_/extensions/[email protected]/components/command-processor.js:12221)
我'm confused:/
大尖,似乎做什么我想它做的事。总之,有一个问题你可以帮我 – steph 2015-04-01 10:19:36
这个问题会是什么? – Joost 2015-04-01 10:21:13
对不起,我被困在互联网连接缓慢,所以我经常按下按钮;) 你可以找到编辑 – steph 2015-04-01 10:30:19