【发布时间】:2020-06-28 13:29:08
【问题描述】:
我正在使用 Chrome 浏览器,如何使用 selenium 发送发布请求?
我找到了这个答案Is there any way to start with a POST request using Selenium?,但建议的解决方案有点过时(2016 年最后一次更新) 过时的库https://pypi.org/project/selenium-requests/
我的代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
driver = webdriver.Chrome(executable_path=driver_path, options=options)
response = driver.request('POST', url, data={"key_1": 'value_1', 'key_2': 'value_2'})
# AttributeError: 'WebDriver' object has no attribute 'request'
附:当没有找到已经存在的答案时,我感到很惊讶。
【问题讨论】:
标签: python selenium selenium-webdriver selenium-chromedriver