草庐IT

chromePrefs

全部标签

java - 如何在 selenium Chrome 功能中设置默认下载目录?

请找到以下具有chrome功能的代码。实际上浏览器并没有将文件下载到指定路径。privatestaticDesiredCapabilitiesgetChromeCapabilities()throwsException{StringchromePath=BrowserUtil.class.getResource("/Browserdrivers/chromedriver.exe").getPath();System.setProperty("webdriver.chrome.driver",chromePath);StringdownloadFilepath="C:\\TestDown