WebBrowser problem to click on site elements

1

Hello everyone! I need to access this link: link

Using IE, Chrome, Firefox ... any browser I normally get without any error, but when trying to access this link through Webbrowser the site simply gets bugged.

1) I'll explain it better: There's an area for comments below. A photo for better understanding: link

2) When I click on this textarea to comment, quickly in any browser the component stretches. A photo for better understanding: link

However, when you access the same link using the Webbrowser, clicking the comments textarea nothing happens. The page element stays in the home position, as if I had not even clicked ...

Can anyone give me a glimpse of what is happening and how can I solve this problem?

Thank you in advance!

    
asked by anonymous 09.08.2015 / 22:58

1 answer

1

I'm doing an advanced browser and edited a lot in it to remove script errors and render the page better, but I'll share a part of my code to see if it can help.

'Coloque isso no método iniciador da forma principal (Form1)
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(Function() True)

Ok, so it will ignore certificate errors, but this will not make sense now, put that line, has to be the first expression of the Load event of your WebBrowser :

 'Ao carregar seu Webbrowser (WebBrowser1.Load):
 WebBrowser1.ScriptErrorsSuppressed = True

WebBrowser is rendered by the Internet Explorer 7 renderer (unfortunately), but fortunately we can put it to the highest version, in case IE 11 .

This part is what will make the most difference, put this code in the Application.Designer.vb file

  

Located in your project directory, go to the My Project folder and the file will be there.

Put this method Namespace My.MyApplication :

  Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
     CreateBrowserKey()
  End Sub

  Private Sub MyApplication_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
     ' Se quiser que remova a propriedade:
     ' RemoveBrowerKey()
  End Sub

  Private Const BrowserKeyPath As String = "\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION"

  Private Sub CreateBrowserKey(Optional ByVal IgnoreIDocDirective As Boolean = False)
     Dim basekey As String = Microsoft.Win32.Registry.CurrentUser.ToString
     Dim value As Int32
     Dim thisAppsName As String = My.Application.Info.AssemblyName & ".exe"

     ' Value reference: http://msdn.microsoft.com/en-us/library/ee330730%28v=VS.85%29.aspx
     ' IDOC Reference:  http://msdn.microsoft.com/en-us/library/ms535242%28v=vs.85%29.aspx
     Select Case (New WebBrowser).Version.Major
        Case 8 'Internet Explorer 8
           If IgnoreIDocDirective Then
              value = 8888
           Else
              value = 8000
           End If

        Case 9 'IE 9
           If IgnoreIDocDirective Then
              value = 9999
           Else
              value = 9000
           End If
        Case 10 'IE 10
           If IgnoreIDocDirective Then
              value = 10001
           Else
              value = 10000
           End If

        Case 11 'IE 11
           If IgnoreIDocDirective Then
              value = 11001
           Else
              value = 11000
           End If

        Case Else ' não achou o ie?!
           Exit Sub

     End Select

     Microsoft.Win32.Registry.SetValue(Microsoft.Win32.Registry.CurrentUser.ToString & BrowserKeyPath,
                                       Process.GetCurrentProcess.ProcessName & ".exe",
                                       value,
                                       Microsoft.Win32.RegistryValueKind.DWord)
  End Sub

  Private Sub RemoveBrowerKey()
     Dim key As Microsoft.Win32.RegistryKey
     key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(BrowserKeyPath.Substring(1), True)
     key.DeleteValue(Process.GetCurrentProcess.ProcessName & ".exe", False)
  End Sub

Try to do this, hugs!

  

Tip: If you can not find the file, place these methods on Form1.

    
12.08.2015 / 01:22