简体   繁体   English

使用 webbrowser 自动向多个用户发送 whatsapp 消息(而不是使用 selenium)

[英]send a whatsapp message to multiple users automatically using webbrowser (and not using selenium)

I am a beginner in this.我是这方面的初学者。

I want to send a WhatsApp message to multiple users using web browser module (and not selenium).我想使用 web 浏览器模块(而不是 selenium)向多个用户发送 WhatsApp 消息。 I have written the following code:我写了以下代码:

import webbrowser

msg = input('Enter a Message: ')
number = input('Enter contact number: ')

number = number.split(',')

for i in number:
    web = webbrowser.open_new_tab(f'https://web.whatsapp.com/send?phone=+91{i}&text={msg}')

I know this is not the best approach as it opens up a WhatsApp tab as many as the total contact number entered by the user and I have to manually hit the send button each time in every tab.我知道这不是最好的方法,因为它打开的 WhatsApp 选项卡与用户输入的总联系号码一样多,而且我必须每次在每个选项卡中手动点击发送按钮。

Is there any better way than this?还有比这更好的方法吗?

Thanks in Advance提前致谢

It's pretty simple.这很简单。 You just need to tell Python to press enter for you.你只需要告诉 Python 为你按回车。 That can be done using pyautogui library.这可以使用 pyautogui 库来完成。

See this code:请参阅此代码:

import pyautogui as pg
pg.press("Enter")

Now you are good to go.现在你对 go 很好。

please, how we by pass whatsapp web to show whatsapp is open in another window... as i want to use webbrowser and pyautogui by reading contcats from excel file via pandas and send message by input or from file please, how we by pass whatsapp web to show whatsapp is open in another window... as i want to use webbrowser and pyautogui by reading contcats from excel file via pandas and send message by input or from file

i success to send just one then whatsapp new tap notification let it stop.我成功发送了一个然后whatsapp新的点击通知让它停止。

i'm biggenner in python so tell me if you have better approach.我是 python 的大人物,所以告诉我你是否有更好的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM