Python - webbrowser

Python - webbrowser
0

#1

Hi

url = 'https://www.freecodecamp.com'
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
webbrowser.get(chrome_path).open(url)

This code helps me to open the website in chrome’s default profile.
But I need to open the url in different user account I have added to my chrome browser.

Can anyone help me…

:wink:


#2

I don’t use Python but i think this will work.

profile = "Default"
url = 'https://www.freecodecamp.com'
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe --profile-directory="{}" %s'.format(profile)
webbrowser.get(chrome_path).open(url)

Change profile to be the appropriate profile name.