Python 3.x Selenium Webdriver:TypeError:getresponse()获得意外的关键字参数';缓冲';

Python 3.x Selenium Webdriver:TypeError:getresponse()获得意外的关键字参数';缓冲';,python-3.x,selenium-webdriver,web-scraping,Python 3.x,Selenium Webdriver,Web Scraping,我正在尝试从本页中获取结果: 这应该很简单。但是,Selenium被卡住了,停止后,我出现以下错误: Traceback (most recent call last): File "/home/blahblah/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 377, in _make_request httplib_response = conn.getresponse(buffering=True) Ty

我正在尝试从本页中获取结果:

这应该很简单。但是,Selenium被卡住了,停止后,我出现以下错误:

Traceback (most recent call last):
File "/home/blahblah/venv/lib/python3.6/site-packages/urllib3/connectionpool.py", line 377, in _make_request
httplib_response = conn.getresponse(buffering=True)
TypeError: getresponse() got an unexpected keyword argument 'buffering'
这是我的密码:

import os
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException,WebDriverException
from webdriver_manager import chrome
# from time import sleep

WORKING_DIR = os.getcwd()
OUTPUT_FILE = os.path.join(WORKING_DIR, "GeneListWLink.csv")  # output file
BASE_URL = 'http://genomics.senescence.info/genes/search.php?show=5&sort=1&page=1'

options = webdriver.ChromeOptions()
# options.add_argument('headless')
driver = webdriver.Chrome(executable_path=chrome.ChromeDriverManager().install(), chrome_options=options)

try:
    print("\nConnecting to %s" % BASE_URL)
    driver.get(BASE_URL)
except WebDriverException:
    print("BASE_URL is not working, please try again.")
    exit()

try:
    results_table = driver.find_element_by_class_name('results-table')
    results = [item.text for item in results_table.find_elements_by_css_selector("th,td")]
except NoSuchElementException:
    print("Could not parse results table.")
    exit()

print(results)  # testing before exporting
#TODO: EXPORT
我知道有一个导出按钮,但它不能正常工作,输出表没有正确对齐

我想知道是什么导致Selenium错误,以及将来可以采取哪些措施来避免它。从前面对类似问题的回答来看,我认为这实际上可能不是一个请求问题,而是代码后面的其他问题。谢谢


编辑:原来代码确实可以运行,但运行时间太长了,我以为程序挂起了。

你真的想使用selenium吗?这些内容在页面源代码中可用,因此您可以使用requets获取它们。实际上,我已经准备好了selenium代码,只需要更改基本url和类名。无论如何,在进一步测试之后,我认为css选择器可能有问题。如果我弄明白了,我会更新/关闭我自己的问题。
请求
中出现以下错误:
读取超时
(在网页抓取过程中非常常见)。@SIM尽管有操作标签和询问……你真的想使用selenium吗。。这纯粹是一种骚扰。请避免这种情况。@DebanjanB我不这么认为,如果我不能使Selenium起作用,我很乐意接受另一种解决方案。