Skip to content

Instantly share code, notes, and snippets.

@jimmykhlam
Last active April 30, 2022 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmykhlam/776952db7a3b21a274c95ae907367353 to your computer and use it in GitHub Desktop.
Save jimmykhlam/776952db7a3b21a274c95ae907367353 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.action_chains import ActionChains
from datetime import datetime
import time
chrome_options = Options()
driver = webdriver.Chrome(options=chrome_options)
driver.get('https://web.whatsapp.com/')
#wait 60 secs to allow for the user to manually scan the Whatsapp Web QR code to log on
el_side = WebDriverWait(driver, 60).until(EC.element_to_be_clickable((By.ID, "side")))
#locate the search box
el_search = el_side.find_element(By.XPATH, "//div[contains(@title, 'Search')]")
print("Logged in and located search box:", el_search)
@jimmykhlam
Copy link
Author

This is a code section from this: https://github.com/jimmykhlam/whatsapp-web-automation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment