selenium不接受我的变量值

时间:2015-10-16 05:28:20

标签: python selenium

这是python或selenium,它不是递增变量“scraped_pa​​ges”的值,也不会识别它的值。

page_num = raw_input("How any page?: ")
urls_list = []
scraped_pages = 0
while scraped_pages <= page_num:
    for li in list_items:
        for a in li.find_all('a', href=True):
            url = a['href']
            if slicer(url,'http'):
                url1 = slicer(url,'http')
                urls_list.append(url1)
            elif slicer(url,'www'):
                urls1 = slicer(url,'www')
                urls_list.append(urls1)
            else:
                pass
    print urls_list         
    scraped_pages +=1
    driver.find_element_by_xpath("/html/body/div[5]/div[4]/div[9]/div[1]/div[3]/div/div[5]/div/span[1]/div/table/tbody/tr/td[12]").click()

它只抓了2页,然后我收到了这个错误。

Traceback (most recent call last):
  File "google page click.py", line 46, in <module>
    driver.find_element_by_xpath("/html/body/div[5]/div[4]/div[9]/div[1]/div[3]/div/div[5]/div/span[1]/div/table/tbody/tr/td[12]").click()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 75, in click

0 个答案:

没有答案