I want to list down the all tab titles in already opened browser.
I have used Python and selenium webdriver package but it is creating a new browser session and listing out the tab names instead of listing from already opened browser
I have tried with Python 3.7 version and selenium package
import selenium.webdriver as webdrive
path=r"C:\Windows\chromedriver"
driver=webdriver.Chrome(executable_path=path)
browser.get('https://www.google.com?q=python#q=python')
length=len(driver.window_handles)
titles=[]
for i in range(length):
driver.switch_to.window(driver.window_handles[i])
titles.append(driver.title)
print(title)
I am expecting the output in already opened browser not from newly created one.