I need to catch the URL value which is changing dynamically after clicking to login button. driver.getCurrentUrl() is saving only latest url, which is static. I need somehow to save couple of urls which are changing dynamically during the login process and save it to string or to some array. can somebody help me?
@Test
public void expireTest() {
driver.get("https://url/default/login");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.id("username")).sendKeys("name");
driver.findElement(By.id("password")).sendKeys("pass");
driver.findElement(By.cssSelector("input[value='someInputValue']")).click();
getUrlValue();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.MILLISECONDS);
}
public void getUrlValue() {
String urlValue = driver.getCurrentUrl().toString();
if(urlValue.contains("expires_in")){
String newValue = driver.getCurrentUrl().toString();
System.out.print(newValue);
}