Reputation: 75
I already have a question related to this over here but there isn't any response so this question is more "specific" version of that question
So my problem is i run my code it opens Firefox window and opens Whatsapp web but it wont go to the chat but in the login page where i have to take my phone and scan the qr code to get to the chat. Normally once you scan it you wont need to scan it again later cause it will be saved as a cookie(maybe idk ¯\_(ツ)_/¯ ) but in selenium as it creates new temporary profile it never saves it and i have to scan it everytime i run my code!
Is there any way i can save the login stuff from Whatsapp and reuse that again so i can skip the scanning part totally using Firefox(Gecko Driver)
Upvotes: 0
Views: 748
Reputation: 1599
Try this, it worked to me!
dir_path = os.getcwd()
profile = os.path.join(dir_path, "profile", "wpp")
options = webdriver.ChromeOptions()
options.add_argument(
r"user-data-dir={}".format(profile))
driver = webdriver.Chrome(options=options)
driver.get("https://web.whatsapp.com")
documentation link: https://www.selenium.dev/documentation/webdriver/drivers/options/
Upvotes: 1
Reputation: 19
You can try this,
ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir=chrome-data");
WebDriver driver = new ChromeDriver(options);
Upvotes: -1