<a href="!#" data-toggle="dropdown">Shuttle
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/client1/shuttle/">Generate Trips </a>
</li>
</ul>
</li>
Когда я запускаю этот код в браузере Chrome, я получаю правильный текущий URL той же страницы, но когда я запускаю этот же код в браузере Chrome Headless, он выходит из системы на экране. Я также дал тайм-аут загрузки страницы, но не могу получить текущий URL той же страницы.
Я даю безголовому,
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
options.addArguments("--window-size=1440x900");
driver = new ChromeDriver(options);
// Load the properties File
props = new Properties();
props.load(data.class.getClassLoader().getResourceAsStream("application.properties"));
// Get Url
driver.get(props.getProperty("url"));
WebElement first =
driver.findElement(By.xpath(props.getProperty("tabfirst")));
// click trip generate
WebElement second =
driver.findElement(By.xpath(props.getProperty("tabsecond")));
Actions a = new Actions(driver);
a.moveToElement(first).moveToElement(second).click().build().perform();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
System.out.println(driver.getCurrentUrl());
tabfirst=//a[contains(text(),'Shuttle')]
tabsecond=//ul[@class='dropdown-menu']/li[3]/a[contains(text(),'Generate Trips')]