如何使用python中的selenium使用单个xpath刮取多个url?

时间:2016-01-13 11:26:29

标签: python xml selenium xpath

mydriver = webdriver.Firefox()
mydriver.get(baseurl)
mydriver.find_element_by_xpath(xpaths['searchboxTxtBox']).clear()
mydriver.find_element_by_xpath(xpaths['searchboxTxtBox']).send_keys(searchbox)
mydriver.find_element_by_xpath(xpaths['submitButton']).click()

data = mydriver.find_elements_by_xpath('*//div[@class="product-result clearfix"]//h3//a//@href')

for element in data:
    print element.get_attribute("innerHTML")

在执行上面的代码时,它会抛出错误:

the given selector is either invalid or does not result in a Web Element. 

我需要抓一些url的帮助

0 个答案:

没有答案