Выбивает ошибку в функции a_proxy33()?

Почему у меня ошибку выбивает a_proxy33() и как спарсить ссылки?Нужно именно на селениуме парсить!!

from selenium.common.exceptions import ElementClickInterceptedException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from bs4 import BeautifulSoup as BS
import requests
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from bs4 import BeautifulSoup as BS
options.binary_location ='\\chrome.exe'
driver = webdriver.Chrome(chrome_options=options, 
executable_path=r"\chromedriver90.exe")
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) 
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36'}
 options.add_argument("--headless")





def sait2_req2():#list index out of range
    url = "http://free-proxy.cz/ru/"
    id = "proxy_list"
    parsed = driver.get(url)
    table_id = parsed.find_element(By.ID, 'proxy_list')
    tbody = table_id.find_element_by_tag_name('tbody')
    rows = tbody.find_elements(By.TAG_NAME, "tr")  # get all of the rows in the table
    for row in rows:
        # Get the columns (all the column 2)
        col = row.find_elements(By.TAG_NAME, "td")[0]# note: index start from 0, 1 is col 2
        for rows in rows:
            col1 = rows.find_elements(By.TAG_NAME, "td")[1]
            tre = col.text + ':' + col1.text
            print(tre)  # prints text from the element


sait2_req2()
def a_proxy33():#'NoneType' object has no attribute 'content'
    teg = "paginator"
    urt = "http://free-proxy.cz/"
    r = requests.get("http://free-proxy.cz/ru/")
    html = BS(r.content, 'html.parser')
    # get all of the rows in the table
    for el in html.select('.paginator'):
        url_more = el.select('a').get('href')
        print(url_more)
        #sait2_req2()                                  
   a_proxy33()#'NoneType' object has no attribute 'content'

##list index out of range ##

67.207.83.225:80
67.207.83.225:3128
67.207.83.225:80
67.207.83.225:8080
list index out of range

Проблема только в кусочке кода другие функции нормально выводятца. А еще браузер открыт но почему-то через пять мин пишет ошибка.Почему-то не работает безголовый режим в хроме 90?П.с подправила но выдает такую ошибку ? Почему-то ошибки именно в функции a_proxy33() возникают.


Ответы (1 шт):

Автор решения: Them Forest

путь правильно указал? если правильно то дальше ты должен сравнить драйвер браузера который скачал и свой браузер по умолчанию. их версии должны совпадать. если они отличаются удали и скачай драйвер заново, совпадающий с браузером

→ Ссылка