Youtube icon indicating copy to clipboard operation
Youtube copied to clipboard

update3 not working any more

Open tomcontr opened this issue 5 years ago • 3 comments
trafficstars

Hi, Great work!

Do you have an updated version? Update3 seems not to work anymore...

REgards!

tomcontr avatar Mar 22 '20 21:03 tomcontr

Fixed... this one works.

import os

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.keys import Keys

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DRIVER_BIN = os.path.join(PROJECT_ROOT, "chromedriver")

driver = webdriver.Chrome(executable_path = DRIVER_BIN)

#driver=webdriver.Chrome()
driver.get('https://web.whatsapp.com/')
wait = WebDriverWait(driver, 600)

name=input('Enter the name of contact or group you want to text: ')
text=input('Enter the text you want to send: ')
n=int(input('Enter the number of times you want the text to be sent: '))
input('Make sure you have scanned the QR code of whatsapp web. After that, press any key')

user = driver.find_element_by_xpath('//*[@id="side"]/div[1]/div/label/div/div[2]'.format(name))
user.send_keys(name)
time.sleep(2);
user.send_keys(Keys.RETURN);

text_box = driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')
for i in range(n):
    text_box.send_keys(text)
    butn = '_3M-N-'
    button=wait.until(EC.presence_of_element_located((By.CLASS_NAME,butn)))
    button.click()

tomcontr avatar Mar 22 '20 21:03 tomcontr

Fixed... this one works.

import os

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.keys import Keys

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
DRIVER_BIN = os.path.join(PROJECT_ROOT, "chromedriver")

driver = webdriver.Chrome(executable_path = DRIVER_BIN)

#driver=webdriver.Chrome()
driver.get('https://web.whatsapp.com/')
wait = WebDriverWait(driver, 600)

name=input('Enter the name of contact or group you want to text: ')
text=input('Enter the text you want to send: ')
n=int(input('Enter the number of times you want the text to be sent: '))
input('Make sure you have scanned the QR code of whatsapp web. After that, press any key')

user = driver.find_element_by_xpath('//*[@id="side"]/div[1]/div/label/div/div[2]'.format(name))
user.send_keys(name)
time.sleep(2);
user.send_keys(Keys.RETURN);

text_box = driver.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')
for i in range(n):
    text_box.send_keys(text)
    butn = '_3M-N-'
    button=wait.until(EC.presence_of_element_located((By.CLASS_NAME,butn)))
    button.click()

Hi the above code doesnt work for me it types the message in my search bar

hkarthik97 avatar Mar 30 '20 11:03 hkarthik97

check in my repositroies i made a updated version and its fully working

heykush avatar May 18 '20 14:05 heykush