您好,我正在尝试运行自动搜索并从网络数据库中获取结果, 我有以下代码:
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/