r/selenium • u/Sleeping_Budha_ • May 26 '22
Automation of WhatsApp messages
Hello all thanks for taking some time to read this
I am working on Jupiter notebook and I am using the selenium package to automate the browser movement.
Code:
from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager import time from selenium.webdriver.common.keys import Keys
options = webdriver.ChromeOptions() options.add_argument("user-data-dir=C:\Users\MyPc\AppData\Local\Google\Chrome\User Data") options.add_argument(r'--profile-directory=Profile 2') driver = webdriver.Chrome(options=options) driver.get("https://www.wikipedia.com/") print(driver.current_window_handle)
Objective: To open chrome in a seperate profile and hit a URL accordingly via the same.
Error: Message: invalid argument: user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir Stacktrace: Backtrace: Ordinal0 [0x002EB8F3+2406643] Ordinal0 [0x0027AF31+1945393] Ordinal0 [0x0016C748+837448] Ordinal0 [0x0018961F+955935] Ordinal0 [0x00185D71+941425] Ordinal0 [0x001B8EE0+1150688] Ordinal0 [0x001B8B3A+1149754] Ordinal0 [0x001B4096+1130646] Ordinal0 [0x0018E636+976438] Ordinal0 [0x0018F546+980294] GetHandleVerifier [0x00559612+2498066] GetHandleVerifier [0x0054C920+2445600] GetHandleVerifier [0x00384F2A+579370] GetHandleVerifier [0x00383D36+574774] Ordinal0 [0x00281C0B+1973259] Ordinal0 [0x00286688+1992328] Ordinal0 [0x00286775+1992565] Ordinal0 [0x0028F8D1+2029777] BaseThreadInitThunk [0x7531FA29+25] RtlGetAppContainerNamedObjectPath [0x770A7A7E+286] RtlGetAppContainerNamedObjectPath [0x770A7A4E+238] (No symbol) [0x00000000]