0

I want to automatize some tasks on WhatsApp Web using Python and Selenium over my Raspberry Pi 3B+ and I'm having difficulties to find a web browser that's compatible with all these requirements.

  • I tried Chromium but WhatsApp Web doesn't work and the page directs to other modern browsers (I tried this);
  • I tried Firefox, but geckodriver (the webdriver of Firefox) does not have an updated Arm7 driver (most recent is V 0.23 and does not work on the most recent Firefox version required by WhatsApp Web);
  • And finally I read about Chrome, which is not compatible with Raspberry Pi.

I am lost and don't know what to do.

Glorfindel
  • 620
  • 1
  • 8
  • 15

1 Answers1

1

I have WhatsApp Web working on Rasp Pi. I use Chromium and the ChromiumDriver.

First install the Chromium Browser and WebDriver. Copy the below in your Terminal.

sudo apt-get install chromium-chromedriver

Here is my Python code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

options = Options() options.add_argument("--user-data-dir=chrome-data") #this is needed to stop WhatsApp asking for QR code verification after your first time options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False)

driver = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', options=options) driver.maximize_window() driver.get('https://web.whatsapp.com') time.sleep(10) driver.find_element_by_xpath("//[@title='REMOVED']").click() #change Removed to the number of group you are sending a message to driver.find_element_by_xpath('//[@id="main"]/footer/div[1]/div[2]/div/div[2]').send_keys('MESSAGE HERE') driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[3]/button/span').click() time.sleep(5)

I have only found one error and forward slashes will not send. Here is my Stack Overflow post about it. I found your post while trying to resolve my error.

Please note I am on a Raspberry 4 and I'm not 100% sure if it will work on Raspberry 3.

Glorfindel
  • 620
  • 1
  • 8
  • 15
Ollie
  • 21
  • 2