0

I'm developing a twitter management tool for a company that needs to automate the twitter like button.

It turns out that I can not automate the click in any way.

Does anyone have any suggestions on how I can do this?

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
        For Each webpageelement As HtmlElement In allelements
            ListBox1.Items.Add(webpageelement.GetAttribute("class"))
            If webpageelement.GetAttribute("class") = "css-1dbjc4n r-sdzlij r-1p0dtai r-xoduu5 r-1d2f490 r-xf4iuw r-u8s1d r-zchlnj r-ipm5af r-o7ynqc r-6416eg" Then
                webpageelement.InvokeMember("click")

            End If
        Next
    End Sub
Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
Bianca B.
  • 3
  • 3
  • The attribute is `className` (written exactly like this), not `class` (you won't find any matching elements with this attribute). You should also let your Browser handle the underlying scripts, enabling the IE11/Edge compatibility mode. See: [How can I get the WebBrowser control to show modern contents?](https://stackoverflow.com/a/38514446/7444103). – Jimi Jun 09 '19 at 14:12

1 Answers1

0

Stephen,

I updated the Getattribute terms and modified the app.exe parameters in the registry according to the tutorial.

The code continues to fail in automating clicks on twitter like buttons.

Thank you for your attention, though.

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim allelements As HtmlElementCollection = WebBrowser1.Document.All For Each webpageelement As HtmlElement In allelements If webpageelement.GetAttribute("className") = "css-1dbjc4n r-xoduu5" Then webpageelement.InvokeMember("click") End If Next End Sub

Bianca B.
  • 3
  • 3