Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 318fb6c

Browse files
added success message and try catch
1 parent 1a7a43c commit 318fb6c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

‎Whatsapp_Automation/whatsappAutomation.py‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ def whatsapp(to, message):
2323
user.click()
2424
text_box = driver.find_element_by_xpath(
2525
'//*[@id="main"]/footer/div[1]/div[2]/div/div[2]')
26-
text_box.send_keys(string)
27-
sendbutton = driver.find_elements_by_xpath(
28-
'//*[@id="main"]/footer/div[1]/div[3]/button')[0]
29-
sendbutton.click()
30-
sleep(10)
26+
try:
27+
text_box.send_keys(string)
28+
sendbutton = driver.find_elements_by_xpath(
29+
'//*[@id="main"]/footer/div[1]/div[3]/button')[0]
30+
sendbutton.click()
31+
sleep(10)
32+
print('Message Sent!!')
33+
except:
34+
print('Error occured....')
3135

3236

3337
if __name__ == "__main__":

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /