遂宁微章建设举报网站,长沙长沙网站建设,网站开发文档管理工具,公司网站开发需求文档我试着按照前面关于这个主题的文章来写#xff0c;比如这些(post 1#xff0c;post 2)#xff0c;但是我还是被卡住了。我的脚本必须使用一组凭据登录到站点#xff0c;然后通过一些下拉菜单导航以选择报表。选择报表后#xff0c;将弹出一个新窗口#xff0c;在该窗口中…我试着按照前面关于这个主题的文章来写比如这些(post 1post 2)但是我还是被卡住了。我的脚本必须使用一组凭据登录到站点然后通过一些下拉菜单导航以选择报表。选择报表后将弹出一个新窗口在该窗口中必须调整参数才能生成报表。设置参数后相同的弹出窗口将刷新以PDF格式生成的报告并使用Chrome内置的PDF查看器显示。我当时的印象是将某些选项传递给webdriver会禁用这个PDF查看器只需下载文件但PDF查看器仍在显示不会自动下载任何内容。我肯定是漏掉了什么或者我写错了什么。下面是我的代码from selenium import webdriverfrom selenium.webdriver.common.action_chains import ActionChainsfrom selenium.webdriver.chrome.options import Optionschrome_options Options()chrome_options.add_experimental_option(prefs, {download.default_directory: download_dir,download.prompt_for_download: False,download.directory_upgrade: True,plugins.plugins_disabled: [Chrome PDF Viewer]})browser webdriver.Chrome(options chrome_options)driver webdriver.Chrome()driver.get(url)#In between here are a bunch of steps here that navigates through drop down menus#This step may not be necessary, but I figured Id include it to address when the pop up window refreshes and displays the report in PDF format through Chromes PDF viewerdriver.switch_to.window(driver.window_handles[1])因此在这一点上Chrome仍然显示PDF查看器尽管我之前禁用了它。没有下载任何内容因此我想知道是否需要提供另一行代码或其他内容。在Windows10上使用Selenium版本3.141.0、Python3.6.4、ChromeWebDriver2.45。