#120 disable start browser on run application

This commit is contained in:
Anton Romanov 2019-05-23 16:36:48 +04:00
parent c303d65c8d
commit 181086c9db

View File

@ -32,17 +32,16 @@ public class KiasService {
private final static String DRIVER_TYPE = "webdriver.chrome.driver"; private final static String DRIVER_TYPE = "webdriver.chrome.driver";
private final UserService userService; private final UserService userService;
private WebDriver webDriver;
public KiasService(UserService userService) { public KiasService(UserService userService) {
System.setProperty(DRIVER_TYPE, getDriverExecutablePath());
this.userService = userService; this.userService = userService;
final ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
webDriver = new ChromeDriver(chromeOptions);
} }
public List<GrantDto> getNewGrantsDto() throws ParseException { public List<GrantDto> 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)); webDriver.get(String.format(BASE_URL, CONTEST_STATUS_ID, CONTEST_TYPE, CONTEST_YEAR));
KiasPage kiasPage = new KiasPage(webDriver); KiasPage kiasPage = new KiasPage(webDriver);
List<WebElement> kiasGrants = new ArrayList<>(); List<WebElement> kiasGrants = new ArrayList<>();
@ -64,7 +63,7 @@ public class KiasService {
kiasGrants.clear(); kiasGrants.clear();
} }
while (kiasPage.checkPagination()); //проверка существования следующей страницы с грантами while (kiasPage.checkPagination()); //проверка существования следующей страницы с грантами
webDriver.quit();
return newGrants; return newGrants;
} }