Open collinsuzebu opened 3 years ago
Good to know. You're welcome. If you had to figure out additional steps, let me know too so I can add it. :)
Great, Yeah, Whatsapp on login changes the QR every 20 seconds for 5 or 6 times and then you have to click to reload your QR (which I think the driver.reload_qr()
does),
So, I'm trying to figure out how to automatically catch the changed QR code every 10 seconds and save it also until it stops changing and then I have to call the driver.reload_qr()
after it stopped changing.
Also saving the profile seems to not work when I re run this command :
docker run --network selenium -it -e SELENIUM='http://firefox:4444/wd/hub' -v $(pwd):/app webwhatsapi /bin/bash -c "pip install ./;pip list;python sample/remote.py"
I have to scan for the QR again.
I'm using the remote setup and using the VNC viewer
Thanks for the consideration.
I agree with previous profile not getting loaded even after been saved. There was a work around I did for a project where I used it, I'd check with the organization team if I could still get access to the private repo.
For the other problem you mentioned, the login process does not work that way. Once logged in with a qr_code, the account remain logged in. The qr_code expires quickly (<60secs) and can only be used once.
I referred to your guide and I did it like below, which seems to work, even after I restarted the containers the session was still there
profiledir = os.path.join(".", "/app/firefox_cache") # this is a directory
driver = WhatsAPIDriver(profile=profiledir, client="remote", command_executor=os.environ["SELENIUM"])
Yes, the session persist even after the container is shutdown. You could always implement a functionality that destroys created session when containers are shutdown.
Take a look at this issue for restoring previous session on startup.
Any idea on how to reuse the same window instead of creating a window every time you run a python script. Thanks.
I can't be sure, but I haven't come across the API for that. What has helped me in the passed was gracefully shutting down a window when the application quits. driver.close()
This guide actually helped me. Thanks