我正在尝试从网页上的链接下载文件。不过,我得到了恼人的警告“这种类型的文件可能会损害…无论如何?保留,丢弃”。我试了好几种方法来避免警告,但还是收到了。我正在使用robot框架,但是我正在使用python为我创建新的关键字。
@keyword('open "${url}" in chrome browser')
def open_chrome_browser(self, url):
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")
options.add_argument("--disable-web-security")
options.add_argument("--allow-running-insecure-content")
options.add_argument("--safebrowsing-disable-extension-blacklist")
options.add_argument("--safebrowsing-disable-download-protection")
prefs = {'safebrowsing.enabled': 'true'}
options.add_experimental_option("prefs", prefs)
self.open_browser(url, 'chrome',alias=None, remote_url=False, desired_capabilities=options.to_capabilities(), ff_profile_dir=None)
有人能建议一种方法来禁用下载警告吗?
目前没有回答
相关问题 更多 >
编程相关推荐