테스트는 다운로드 템플릿 링크를 클릭하여 파일을 다운로드하는 것입니다. 로컬 컴퓨터에서 스크립트를 실행하면 완벽하게 작동합니다. 다운로드 폴더를 만들 수 있으며 다운로드 한 파일은 새로 생성 된 "다운로드"폴더에 저장됩니다. 그러나 젠킨스 파이프 라인에이 파일을 통합하면 생성 된 폴더가없고 파일도 다운로드되지 않습니다. 참고 : jenkins 파이프 라인에서 스크립트는 셀렌 그리드에서 크롬을 사용하여 실행됩니다. 크롬 드라이버의 구성을 참조하십시오.Selenium : Jenkins 파이프 라인에서 다운로드 할 폴더와 파일을 만들 수 없습니다.
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", System.getProperty("user.dir") + "\\src\\main\\resources\\downloads");
ChromeOptions options = new ChromeOptions();
HashMap<String, Object> chromeOptionsMap = new HashMap<String, Object>();
options.setExperimentalOption("prefs", chromePrefs);
options.addArguments("--test-type");
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(ChromeOptions.CAPABILITY, chromeOptionsMap);
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setCapability(ChromeOptions.CAPABILITY, options);
driver = new RemoteWebDriver(new URL(seleniumGridUrl), cap);