Skip to content

Instantly share code, notes, and snippets.

#define a helper function
def click_modal_button(button_text):
modal_button = WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, "//div[@data-animate-modal-body='true']//div[@role='button']//div[text() = '%s']" % (button_text))))
#define a function that adds contact_to_add to group_name
def add_contact_to_group(group_name, contact_to_add):
#find chat with the correct title
el_target_chat = WebDriverWait(driver, 5).until(EC.element_to_be_clickable((By.XPATH, "//span[@title='%s']" % (group_name))))
list_chat_groups_test = [
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from import Options
from selenium.webdriver.common.keys import Keys
from import By
from import WebDriverWait
from import expected_conditions as EC
from import Select
from selenium.webdriver.common.action_chains import ActionChains
from datetime import datetime
jimmykhlam / gist:1396394
Created November 26, 2011 22:18
Modifying jQuery mousehold event plugin to pass through original mousedown event
* jQuery mousehold plugin - fires an event while the mouse is clicked down.
* Additionally, the function, when executed, is passed a single
* argument representing the count of times the event has been fired during
* this session of the mouse hold.
* @author Remy Sharp (
* @date 2006-12-15
* @example $("img").mousehold(200, function(i){ })
* @desc Repeats firing the passed function while the mouse is clicked down