WebBrowser Function - Click Button Without ID - VB.NET

I need somebody to fix my function so that it will work with all types of YouTube pages - branded / unbranded / old layout / new layout. Should be an easy task for anyone with past webbrowser automation, this is not my area as I usually use sockets compared to browser methods so am not fully versed with this yet.


Private Sub WebBrowserFollowUser(ByRef newBrowser As WebBrowser, ByVal UserID As String)

' Set Variables

Dim FoundComment As Boolean = False

Dim CurTime As Integer = 0

' Reset Timeout

CurTime = 0

' Load Comments Page

[url removed, login to view]("[url removed, login to view]" & UserID)

While (True)

[url removed, login to view]()

If ([url removed, login to view] = [url removed, login to view]) Then

GoTo ContinueProcess001

End If

[url removed, login to view](100)

CurTime += 1

If CurTime >= ([url removed, login to view] * 10) Then Throw New Exception("Loading YouTube Comments Page Timed Out")

End While


' Scrape All Comments

Dim HTMLCollection As HtmlElementCollection


' HTMLCollection = [url removed, login to view]("channel-header-main").GetElementsByTagName("button")

HTMLCollection = [url removed, login to view]("content").GetElementsByTagName("span")

Catch ex As Exception

Throw New Exception("Failed To Parse Comment HTML Elements For User: " & UserID)

End Try

' Loop Elements

Dim Voted As Boolean = False

Dim UnusedEles As String = ""

For Each TmpElement As HtmlElement In HTMLCollection

If Voted = True Then Exit For

' Check For Comment

If [url removed, login to view]("class").Contains("button-subscription-container") OrElse [url removed, login to view]("class").Contains("yt-uix-button-icon-wrapper") OrElse [url removed, login to view]("class").Contains("button-subscribe") OrElse [url removed, login to view]("class").Contains("subscription-button") Then

[url removed, login to view]()

[url removed, login to view]("click")

[url removed, login to view]()

Voted = True

End If


If Voted = False Then

Throw New Exception("Unable To Find Subscribe Button")

End If

End Sub

Habilidades: Automação de Testes, Visual Basic, YouTube

Veja mais: click button without, true automation, subscribe icon, loop net, icon for button, icon button vb net, youtube header, without in, webbrowser, parse an html, id layout, check document focus, main container, net parse html, channel fix, webbrowser find, youtube sub sub, channel page youtube, net loading page, unable load user

Acerca do Empregador:
( 49 comentários ) Uckfield, United Kingdom

ID do Projeto: #4518657

Concedido a:


I am expert in automation, read my pm

$50 USD em 0 dias
(0 Comentários)

3 freelancers estão ofertando em média $97 para esse trabalho


Do read my message.

$130 USD em 1 dia
(19 Comentários)


$111 USD in 0 dias
(0 Comentários)