Selenium Java to get the present browser URL
Codeaft.java
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

class Codeaft
{
    public static void main(String[] args) 
    {   
        System.setProperty("webdriver.chrome.driver", "/home/codeaft/drivers/chromedriver");
        WebDriver driver = new ChromeDriver();
        driver.get("https://codeaft.github.io/testapp/");
        String currentURL = driver.getCurrentUrl();
        System.out.println(currentURL);
        driver.close();
    }
}
Output
https://codeaft.github.io/testapp/
Comments and Reactions