Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automate WhatsApp with Python & store WhatsApp login

I am trying to automate WhatsApp. I use selenium but the issue is that I have to scan QRCode every time I launch a chrome instance. I tried by saving the cookies of logged browser and then load the cookies but it didn't work and still show the QRcode to sign in.

I wanted to store WhatsApp login so that I don't have to log in every time I run the script.

Is this something possible with Selenium or if there is another better way?

like image 544
codewithawais Avatar asked Sep 06 '25 21:09

codewithawais


1 Answers

Add chrome profile , that will allows reusing session data:

chrom_options.add_argument("user-data-dir=C:\\Users\\AppData\\Local\\Google\\Chrome\\User Data")

To get user data drectory:

open : chrome://version in address bar

enter image description here

copy till user data don't need profile part

like image 85
PDHide Avatar answered Sep 11 '25 08:09

PDHide



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!