0

I'm currently operating Visual Studio 2012. I have a "URL Scanner" form where once a url is entered into a text box, four web browsers opens up and inputs the url into the site and displays.

My problem is this, I get multiple script error pop ups with a error box that states

"Object doesn't support property or method 'getElementsByClassName'".

I tried looking up related resolutions but can't get it to work. I'm quite new to VB and hope someone could correct my mistake.

Class MainWindow 

Dim WithEvents ScriptWindow As WebBrowser



Private Sub Enter_Click(sender As Object, e As RoutedEventArgs) Handles Enter1.Click

    If TextBox1.Text = "" Then
        MessageBox.Show("Please type a target URL in the space provided!")

    Else
        'Dim file As System.IO.StreamWriter
        Dim theDate As Date
        theDate = Format(Now(), "short date")
        Textboxdate.Text = theDate


        ' file = My.Computer.FileSystem.OpenTextFileWriter("URLlogs.txt", True)
        'file.WriteLine(TextBox1.Text & " | Date of search: " & Textboxdate.Text)
        'file.Close()

        Dim path As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\URLlogs.txt"
        Dim writer As New System.IO.StreamWriter(path, True)
        writer.WriteLine(TextBox1.Text & " | Date of search: " & Textboxdate.Text)
        writer.Close()



        WebBrowser1.Navigate("https://www.talosintelligence.com/reputation_center/lookup?search=" & TextBox1.Text)
        WebBrowser2.Navigate("https://www.ssllabs.com/ssltest/analyze.html?d=" & TextBox1.Text)
        WebBrowser3.Navigate("https://sitecheck.sucuri.net/results/" & TextBox1.Text)
        WebBrowser4.Navigate("https://quttera.com/detailed_report/" & TextBox1.Text)

    End If




End Sub

Private Sub Reset_Click(sender As Object, e As RoutedEventArgs) Handles Reset.Click
    TextBox1.Text = ""

End Sub

Private Sub TextBox1_TextChanged(sender As Object, e As TextChangedEventArgs) Handles TextBox1.TextChanged

 End Sub









Private Sub SuppressScriptErrors()
    If (WebBrowser1.Document IsNot Nothing) Then
        ScriptWindow = WebBrowser1.Document.Window
    End If
End Sub

Private Sub SuppressScriptErrors2()
    If (WebBrowser2.Document IsNot Nothing) Then
        ScriptWindow = WebBrowser2.Document.Window
    End If
End Sub

Private Sub SuppressScriptErrors3()
    If (WebBrowser3.Document IsNot Nothing) Then
        ScriptWindow = WebBrowser3.Document.Window
    End If
End Sub

Private Sub SuppressScriptErrors4()
    If (WebBrowser4.Document IsNot Nothing) Then
        ScriptWindow = WebBrowser4.Document.Window
    End If
End Sub



Private Sub Startpage1_Click(sender As Object, e As RoutedEventArgs) Handles Startpage1.Click
    Me.Hide()

    Dim startwindow As New StartWindow
    startwindow.Show()
End Sub

Private Sub SearchHistory1_Click(sender As Object, e As RoutedEventArgs) Handles SearchHistory1.Click

    Dim path As String = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\URLlogs.txt"
    If System.IO.File.Exists(path) = True Then
        Process.Start(path)
    Else
        MessageBox.Show("Please generate a search before proceeding")
    End If


End Sub
End Class
LarsTech
  • 80,625
  • 14
  • 153
  • 225
Robert
  • 1
  • Is this WPF? Error looks like it's coming from a remote website, not your code. Which line throws the error? – LarsTech Jun 04 '18 at 15:18
  • Hi LarsTech, yes this is WPF. Also, it's not a specific line that throws the error. This is a script box from the websites that asks for you to click Yes or No to "Do you want to continue running scripts on this page?" popup. – Robert Jun 04 '18 at 15:23
  • Sounds like the error is not in your control. See [Disable JavaScript error in WebBrowser control](https://stackoverflow.com/q/2476360/719186) – LarsTech Jun 04 '18 at 15:26
  • Tried their code in my VB but doesn't seem to be compatible sadly. – Robert Jun 04 '18 at 15:42

0 Answers0