python selenium.webdriver 返回结果 'The requested document was not found on this server'

标签 python selenium webdriver

您好,我正在尝试运行自动搜索并从网络数据库中获取结果, 我有以下代码:

chrome_options = webdriver.ChromeOptions() 
chrome_options.add_argument("--disable-popup-blocking")
driver = webdriver.Chrome(options=chrome_options) 

driver.get('http://www.ddfint.net/search.cfm/')
search_form=driver.find_element_by_name('compoundName')
search_form.send_keys('Acetylcarnitine')
search_form.submit()

它返回一个未找到的结果,我注意到该网页有一个警告:不安全,其中“popups-redirect”被阻止,一旦我手动删除该阻止,我就能够手动获得结果。我应该在代码中更改什么才能使其工作?我添加的选项不会将默认设置从“阻止”更改为“允许”,谢谢!

我已经尝试过 chrome_options.add_argument("--allow-insecure-localhost") 但这也没有解决我的问题。

最佳答案

从 url 中删除结尾的斜线。你应该使用 http://www.ddfint.net/search.cfm

您可以阅读有关 here 的信息.

关于python selenium.webdriver 返回结果 'The requested document was not found on this server',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58190940/

相关文章:

java - 如何通过 Java 使用 Selenium 定位文章标签内的按钮

google-app-engine - 托管 VM 添加到 PATH

python - Python:上传图片而不会干扰程序的正常流程

python - Sublime Text 插件,从选择中获取行和列

javascript - 如何停止 webdriver 而不导致 Node js 崩溃

java - By.cssSelector() 无法在单选按钮上找到元素 - 这里缺少什么?

python - 如何从 webdriver 访问 Firefox 缓存?

java - TestNG 使用@Factory 和@DataProvider

python - 如何只调用命令而不获取其输出

python - WAV文件保存顺序错误