'How to read all the tabs url from a chrome browser using Python

I have a python code which reads the url of current tab and prints it.

Is there a way to find the number of open tabs in chrome so I can iterate on all tabs and get url.

import pyautogui
pyautogui.click(0, 200) # a random click for focusing the browser
pyautogui.press('f6')

pyautogui.hotkey('ctrl', 'c') # for copying the selected url
import pyperclip # pip install pyperclip required
url = pyperclip.paste()
print(url)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source