Completed

WebBrowser Function - Click Button Without ID - VB.NET

This project was successfully completed by noone2407 for $50 USD in a day.

Get free quotes for a project like this
Employer working
Completed by:
Project Budget
$30 - $250 USD
Completed In
1 day
Total Bids
3
Project Description

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.

Code:
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
ContinueProcess001:
' Scrape All Comments
Dim HTMLCollection As HtmlElementCollection
Try
' 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
Next
If Voted = False Then
Throw New Exception("Unable To Find Subscribe Button")
End If
End Sub

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online