how to get the current URL of the already opened browser?however GetCurrentURL method will help to get the url of the browser which was invoked,i need to get the url of the alredy opened tab. Thanx..
Asked
Active
Viewed 963 times
-1
-
Possible duplicate of [How can I reconnect to the browser opened by webdriver with selenium?](https://stackoverflow.com/questions/47861813/how-can-i-reconnect-to-the-browser-opened-by-webdriver-with-selenium) – undetected Selenium Mar 24 '18 at 20:47
2 Answers
0
AFAIK, It is not possible for webdriver
to attach to running browser. So it's not possible to get the URL.
This link might throw some more light into the issue: Attach to opened browser in WebDriver.

hiren
- 1,067
- 1
- 9
- 16
0
if windows/tabs are opened after selenium webdriver launched
//pseudocode
//get all the windows already opened
Set<String> windows = driver.getAllWindows();
//loop through each windows
for(String s:windows){
driver.switchTo(s);
String title =driver.getCurrentUrl();
//do with url
}

Roushan
- 4,074
- 3
- 21
- 38