Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 97799

Python Selenium automation error with whatsapp

$
0
0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import config_login as logins
import string

times = int(input("how many times?"))
starttimes = 0

def send_times(names, drivers):
    search_name = drivers.find_element_by_class_name("jN-F5")  # finding the search text bar
    search_name.send_keys(names, Keys.RETURN)  # entering name in the bar to go to the chat
    messages = drivers.find_element_by_class_name("_2S1VP")  # finding the message field
    messages.send_keys("hello", Keys.RETURN)  # entering the automated message to candidate

def send_message(start, end):
    driver = webdriver.Firefox()
    driver.get("https://web.whatsapp.com/")
    driver.implicitly_wait(20)
    while start < end:
        name = string.capwords(input("Enter candidates name.\n"))

        send_times(name, driver)
        start += 1

send_message(starttimes, times)

Why does my selenium python code to automate whatsapp messages only send my first message on whatsapp and not the name that is being given from input?? When i put 2 times for the input asking how many times, it ignores the first name i give it and for whatever second name i give it, it just sends the " hello" message to the first chat in my whatsapp messages list. PLEASE HELPPPP!!! THANK YOU SO MUCH!!


Viewing all articles
Browse latest Browse all 97799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>