简体   繁体   English

如何将您的长 WhatsApp 消息作为一条消息而不是多条消息发送

[英]how to send your long WhatsApp message as a single message instead of multiple messages

I am facing issue while sending a long message to whatsApp Web using selenium Python.我在使用 selenium Python 向 WhatsApp Web 发送长消息时遇到问题。 My message is in UTF-8 formate.我的消息是 UTF-8 格式。 Below is the sample of the message.以下是该消息的示例。

સમરાદિત્ય ચરિત્ર ભવ – ૧ ભાગ – ૨૫ સમરાદિત્ય ચરિત્ર ભવ – ૧ ભાગ – ૨૫

પ્રથમ ભવ:- ગુણસેન(રાજા) – અગ્નિશર્મા (પુરોહિત પુત્ર) પ્રથમભવ:- ગુણસેન(રાજા) – અગ્નિશર્ફફ๪ફ๪ફફફ

રાજમાર્ગ પરથી મહાજનોના ૧૦૮ રથોને રથમહેલ તરફ જતા જોઇને, નગરવાસી લોકો અનેક તર્ક-વિતર્ક કરવા લાગ્યા. રાજમાર્ગપરથીમહાજનોના108રથોનેરથમહેલતરફજતાજોઇને,નગરવાસીલોકોઅનેકતર્ક-વિતર્કકરવાલાગ્યા。

Also please find the code I have tried so far.还请找到我迄今为止尝试过的代码。

from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import codecs
import time

#This code is to deal with the input files
grp_list_file = codecs.open('grp_list.txt','r','utf8')
grp_list_data = grp_list_file.read()
grp_list_split = grp_list_data.split('\n')
grp_list_len = len(grp_list_split)
grp_list_val_data = []

for i in range(grp_list_len):
    temp = grp_list_split[i]
    temp1 = temp.replace('\ufeff','')
    temp2 = temp1.replace('\r','')
    grp_list_val_data.append(temp2)
print('Input file processed successfully')


#This block deals with the input message file
msg_list_file = codecs.open('message.txt','r','utf-8')
msg_list_data = msg_list_file.read()
print('Message file input processed successfully')

#Keep this at here to avoid any future issues
grp_list_file.close()
msg_list_file.close()


#Open the whatsapp web
driver = webdriver.Firefox()
driver.get('https://web.whatsapp.com/')
input('Enter anyhing once the QR code has been scanned successfully')
act = ActionChains(driver)


#Let proceed with the sending message to all groups
for i in range(grp_list_len):
    name = grp_list_val_data[i]
    message = msg_list_data
    #Select the group
    user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(name))
    user.click()
    msg_box = driver.find_element_by_class_name('_3u328')
#    msg_box.send_keys(Keys.SHIFT)
    act.send_keys(Keys.SHIFT,message).perform()
#    msg_box.send_keys(message)
#    act.key_up(Keys.SHIFT)
    send = driver.find_element_by_class_name('_3M-N-')
    time.sleep(10)
    send.click()
    print('Message sent successfully to : ',name)

Could anyone please help to send the entire text in single message instead of multiple message.任何人都可以帮助在单个消息而不是多个消息中发送整个文本。

I found the way to solve the issue with help of copy paste idea.我在复制粘贴想法的帮助下找到了解决问题的方法。 First I copied my data to clipboard and then pasted it to desired text box location.首先,我将数据复制到剪贴板,然后将其粘贴到所需的文本框位置。

Thank you very much for your time and help.非常感谢您的时间和帮助。 :) :)

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

相关问题 如何向服务器发送多条消息,并让该服务器接收多条消息而不是一条大消息 [Python,套接字] - How can I send multiple messages to a server, and have that server receive multiple messages instead of one big message [Python, Sockets] 如何使用 Whatsapp Cloud API 发送短信 - How to send a text message with Whatsapp Cloud API 如何定义目录而不是单个文件以在 Python 中将多张图片作为 MIME 消息的一部分发送 - How to define a directory instead of a single file to send multiple pictures as part of MIME message in Python 使用 webbrowser 自动向多个用户发送 whatsapp 消息(而不是使用 selenium) - send a whatsapp message to multiple users automatically using webbrowser (and not using selenium) 如何从电报聊天中保存邮件并使用您自己的帐户发送其他邮件? - How to save a message from a telegram chat and send other messages with your own account? 如何将一条消息发送给多个标记的用户? (discord.py) - How to send a single message to multiple tagged users? (discord.py) 如何在whatsapp中的python,twilio中发送消息并等待回复 - how to send a message and wait for a reply in python, twilio in whatsapp 如何向多个收件人发送邮件? - How to send message to multiple recipients? 尝试使用 python selenium 在 whatsapp 上发送消息 - trying to send message on whatsapp with python selenium 多行发送消息 - Send message on multiple lines
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM