Closed shurjobanerjee closed 3 years ago
What do you mean by stopped working?
Was it earlier working for you?
If yes, when was the last you tested it?
@shauryauppal sir can you check it because its not taking the attached document and sending
def send_files(): global doc_filename
clipButton = browser.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[1]/div[2]/div/div/span')
time.sleep(1)
# To send a Document(PDF, Word file, PPT)
try:
docButton = browser.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[1]/div[2]/div/span/div/div/ul/li[3]/button')
docButton.click()
except:
traceback.print_exc()
time.sleep(1)
docPath = os.getcwd() + "\\Documents\\" + doc_filename
try:
autoit.control_focus("Open", "Edit1")
except :
traceback.print_exc()
autoit.control_set_text("Open", "Edit1", (docPath))
autoit.control_click("Open", "Button1")
time.sleep(3)
whatsapp_send_button = browser.find_element_by_xpath('//*[@id="app"]/div/div/div[2]/div[2]/span/div/span/div/div/div[2]/span/div/div')
whatsapp_send_button.click()
print('File sent')
This is the updated function. Pay attention to the changed xml links . You can change those links to match this function and the code will start working again
Thanks for the mail
On Thu, 19 Nov, 2020, 3:11 PM phanicode, notifications@github.com wrote:
def send_files(): global doc_filename
Attachment Drop Down Menu
clipButton = browser.find_element_by_xpath('//*[@id https://github.com/id="main"]/footer/div[1]/div[1]/div[2]/div/div/span')
time.sleep(1)
To send a Document(PDF, Word file, PPT)
try: docButton = browser.find_element_by_xpath('//*[@id="main"]/footer/div[1]/div[1]/div[2]/div/span/div/div/ul/li[3]/button')
docButton.click()
except: traceback.print_exc() time.sleep(1) docPath = os.getcwd() + "\Documents\" + doc_filename
try: autoit.control_focus("Open", "Edit1") except : traceback.print_exc()
autoit.control_set_text("Open", "Edit1", (docPath)) autoit.control_click("Open", "Button1") time.sleep(3) whatsapp_send_button = browser.find_element_by_xpath('//*[@id="app"]/div/div/div[2]/div[2]/span/div/span/div/div/div[2]/span/div/div') whatsapp_send_button.click() print('File sent')
This is the updated function. Pay attention to the changed xml links . You can change those links to match this function and the code will start working again
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shauryauppal/PyWhatsapp/issues/75#issuecomment-730251784, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP2BYDDRF3MKX2QHKHNEWFTSQTR4DANCNFSM4TQO5ZSA .
@phanicode can you share a PR? I will merge to master
When trying to send attachments, I see the following error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="main"]/header/div[3]/div/div[2]/span/div/div/ul/li[1]/button"}
Any help would be appreciated. I'm not sure how to find the xpath for the attachment option (assuming that a change has occurred on the web interface side).