首页 > 解决方案 > 在 Instagram 上发送消息

问题描述

我正在尝试创建一个 VBA 宏代码,以便在代码中传递的消息可以将代码中定义的配置文件发送给我们配置文件中的每个用户。我正在尝试这样做,首先在 Instagram 和他们上搜索配置文件单击消息选项,然后他们发送消息。但我无法将消息发送到个人资料。

文本区域的 HTML 代码是

<div class="Igw0E IwRSH eGOV_ vwCYk ItkAi"> 
    <textarea class="" style="height: 19px;" placeholder="Message..."> </textarea> 
</div>

<hr>
Sub MessageGalGadot()
Url$ = "https://www.instagram.com/XYZ/"
Dim ie As New InternetExplorer, post As Object
Dim WebUrl As String
Dim i As Integer

With ie
    .Visible = True
    .Navigate Url
    While .Busy = True Or .readyState < 4: DoEvents: Wend

    While post Is Nothing
        On Error Resume Next
        Application.Wait Now + TimeValue("00:00:001")
        Set post = .Document.querySelector(".fAR91.sqdOP.L3NKy._4pI4F._8A5w5 ")
        If Not post Is Nothing Then
            post.Click
            Set msg = .Document.querySelector(".Igw0E.IwRSH.eGOV_.vwCYk.ItkAi ")
            msg.Click
            ie.Document.getElementsByName(".Igw0E.IwRSH.eGOV_.vwCYk.ItkAi").Value = "123"
        Else:
            Debug.Print "trying again"
        End If
        On Error GoTo 0
    Wend

End With
Stop
ie.Quit
End Sub

标签: htmlexcelvbainstagram

解决方案


推荐阅读