Hello guys I'm really a newbie to python and I just writing a piece of code that opens Whatsapp
and you give it the person's name and the message then sends how many times you want.
But when I start debugging the code it gives me this:
Exception has occurred: TypeError 'WebElement' object is not subscriptable File "E:IliyaMy CoursesPythonProjectsWhatsapp RobotWhatsapp_Bot.py", line 15, in <module> msg = driver.find_element_by_class_name('_3FRCZ')[1]
# ======================================
from selenium import webdriver
PATH = 'C:\Program Files (x86)\chromedriver.exe'
driver = webdriver.Chrome(PATH)
driver.get('https://web.whatsapp.com/')
input("Please Press The 'Enter' Button... ")
name = input("Enter Person's Name: ")
msg = input("Enter The Message: ")
counter = int(input("How Many Times Do You Want To Repeat The Message?: "))
user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
user.click()
msg = driver.find_element_by_class_name('_3FRCZ')[1]
for i in range(counter):
msg.send_keys(msg)
button = driver.find_element_by_class_name('_1U1xa')[0]
button.click()
guys please someone good at python answer me !!!????
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…