zvovov / whatsapp-web

WhatsApp chat from [command line, terminal, console, cli] :no_mobile_phones:
MIT License
313 stars 74 forks source link

google-chrome --no-sandbox #10

Closed leonteale closed 3 years ago

leonteale commented 6 years ago

Where in the code woudl I need to edit so that when it tries to launch chrome it adds "--no-sandbox"

this is my error:

Message: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.14.0-kali3-amd64 x86_64)

But chrome will not run if I am root (using kali) and it needs the "--no-sandbox"

e.g.

google-chrome --no-sandbox

Please do not suggest not running as root, I am pentesting and often use kali as root.

Thanks.

BanjoCam commented 6 years ago

Hi leonteale, I have never written a github comment before and probably aren't super qualified but I just happened to be passing by here to try out the script and I think I can help! I happen to be working on a personal project that uses selenium & chromedriver so I have a bit of experience with it.

To add options to the chromedriver, find the line (currently line 56) in chat.py: driver_options.add_argument("user-data-dir={0}".format(chrome_data_dir_directory)) add a new line below that says driver_options.add_argument("--no-sandbox") make sure it's ABOVE the line: driver = webdriver.Chrome(config['chromedriver_path'], chrome_options=driver_options) as this is there the options are passed to the chromedriver.

I tested this on my machine and it threw no errors, but I'm unable to test the efficacy of adding the argument. I'm not sure if the preceding -- is required when passing in arguments this way (I don't think it matters either way as I think it's smart enough to interpret with or without) but if it doesn't work for you, maybe try again without the dashes ie driver_options.add_argument("no-sandbox") Hope this helps!

zvovov commented 6 years ago

This is why I love open source. @BanjoCam