نام و نام خانوادگی:سجاد سعیدی
دوره:کاربردی(پایتون)
نام و نام خانوادگی:سجاد سعیدی
دوره:کاربردی(پایتون)
from selenium import webdriver from selenium.webdriver.common.keys import Keys import os import time import sys from tkinter import * root = Tk() root.title("Bot WhatsApp") root.geometry('300x500') def clear_text(self): txtE.delete(0, 'end') def new_label(event=None): global sms Entree = txtE.get() sms = Entree.title() clear_text(txtE) print(sms) lbl1 = Label(root, text='Enter your message : ') lbl1.pack() txtE = Entry(root) txtE.focus() txtE.pack() Button(root, text='Enter', command=new_label).pack() Button(root, text='Quit', command=root.destroy).pack(side=BOTTOM) root.bind('', new_label) def clear_text2(self): txtE2.delete(0, 'end') def new_label2(event=None): global number Entree2 = txtE2.get() number = Entree2.title() clear_text2(txtE2) print(number) return number print(new_label2()) lbl12 = Label(root, text='Frequently send messages : ') lbl12.pack() txtE2 = Entry(root) txtE2.focus() txtE2.pack() Button(root, text='Enter', command=new_label2).pack() root.bind('', new_label2) def clear_text3(self): txtE3.delete(0, 'end') def new_label3(event=None): global names Entree3 = txtE3.get() names = Entree3.title().split('-') clear_text3(txtE3) print(names) return names print(new_label3()) lbl13 = Label(root, text='names [- splited] : ') lbl13.pack() txtE3 = Entry(root) txtE3.focus() txtE3.pack() Button(root, text='Enter', command=new_label3).pack() root.bind('', new_label3) root.mainloop() path = os.path.dirname(os.path.abspath(__file__)) address = os.path.join(path , 'geckodriver.exe') driver = webdriver.Firefox() driver.get('https://web.whatsapp.com/') input('Press Enter to run : ') for i in names: username = driver.find_element_by_xpath(f"//span[@title='{i}']") username.click() time.sleep(2) k = driver.find_element_by_xpath('//html/body/div[1]/div/div/div[4]/div/footer/div[1]/div[2]/div/div[2]') for j in range(int(number)): k.send_keys(sms) time.sleep(2) button = driver.find_element_by_xpath(f'/html/body/div[1]/div/div/div[4]/div/footer/div[1]/div[3]/button') button.click()
نقد و بررسیها
هیچ دیدگاهی برای این محصول نوشته نشده است.