From 181086c9db9e7eb5683c520d4a89110d6561b38f Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Thu, 23 May 2019 16:36:48 +0400 Subject: [PATCH] #120 disable start browser on run application --- src/main/java/ru/ulstu/grant/service/KiasService.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/ru/ulstu/grant/service/KiasService.java b/src/main/java/ru/ulstu/grant/service/KiasService.java index 6ff0bd9..449b948 100644 --- a/src/main/java/ru/ulstu/grant/service/KiasService.java +++ b/src/main/java/ru/ulstu/grant/service/KiasService.java @@ -32,17 +32,16 @@ public class KiasService { private final static String DRIVER_TYPE = "webdriver.chrome.driver"; private final UserService userService; - private WebDriver webDriver; public KiasService(UserService userService) { - System.setProperty(DRIVER_TYPE, getDriverExecutablePath()); this.userService = userService; - final ChromeOptions chromeOptions = new ChromeOptions(); - chromeOptions.addArguments("--headless"); - webDriver = new ChromeDriver(chromeOptions); } public List getNewGrantsDto() throws ParseException { + System.setProperty(DRIVER_TYPE, getDriverExecutablePath()); + final ChromeOptions chromeOptions = new ChromeOptions(); + chromeOptions.addArguments("--headless"); + WebDriver webDriver = new ChromeDriver(chromeOptions); webDriver.get(String.format(BASE_URL, CONTEST_STATUS_ID, CONTEST_TYPE, CONTEST_YEAR)); KiasPage kiasPage = new KiasPage(webDriver); List kiasGrants = new ArrayList<>(); @@ -64,7 +63,7 @@ public class KiasService { kiasGrants.clear(); } while (kiasPage.checkPagination()); //проверка существования следующей страницы с грантами - + webDriver.quit(); return newGrants; }