none
Retrieving tab-based info (script-errors)

    Question

  • Hi,

    when i want to download fe. the following web-site:

    WebBrowser1Adres = "https://familysearch.org/ark:/61903/3:1:3QS7-99Q8-PCWD?i=1&cat=2555205"
    WebBrowser1.Navigate(WebBrowser1Adres)

    I get a lot of script-errors. Introducing the

    WebBrowser1.ScriptErrorsSuppressed = True                

    disables these errors, but the page is still not correctly loaded.

    What I really want to do is retrieving the information under the "Image Index"-tab. Can somebody help me?

    Thanks

    Sunday, March 12, 2017 10:22 AM

Answers

  • Hi, just to say that my program is working now: I had to do 2 things:

    1. As suggested above: force the WebBrowser to use the IE11 features with the following code:

    Dim k = 11000
    Dim n = My.Application.Info.AssemblyName
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".exe", k)
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".vshost.exe", k)
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".exe", k)
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".vshost.exe", k)

    2. To copy the complete html-page with table: you need to do a "select all" before you can work with it. Since the WebBrowser doesn't have a "select all" function, you can do it in this way:

    WebBrowser1.Document.ExecCommand("SelectAll", True, vbNull)
    WebBrowser1.Document.ExecCommand("Copy", True, vbNull)
    ' Declare an IDataObject to hold the data returned from the clipboard.
    ' Retrieve the data from the clipboard.
    Dim iData As IDataObject = Clipboard.GetDataObject()
    TextBox1.Text = iData.GetData(DataFormats.Html)

    These 2 fixes solved my problem.

    Willy

    • Marked as answer by WilTro Friday, April 07, 2017 1:56 PM
    Friday, April 07, 2017 1:56 PM

All replies

  • Try specifying a special Registry value that changes the behaviour of WebBrowser control: https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version. To be sure, you can write all of the four values: https://social.msdn.microsoft.com/Forums/en-US/92e5444d-8861-4c83-bc68-1bc44900625c. Can be done manually too.

    Sunday, March 12, 2017 5:05 PM
  • Tryed the Register.Setvalue, but get a warning on the first occurence:

    System.NullReferenceException was unhandled
      Message=Object variable or With block variable not set.
      Source=Microsoft.VisualBasic
      StackTrace:
           at Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object Instance)
           at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
           at SearchDump.Form1.Form1_Load(Object sender, EventArgs e) in D:\Visual Studio\Visual Studio 2015\Projects\FSDump1\Form1.vb:line 19
           at System.EventHandler.Invoke(Object sender, EventArgs e)
           at System.Windows.Forms.Form.OnLoad(EventArgs e)
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl()
           at System.Windows.Forms.Control.WmShowWindow(Message& m)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      InnerException:

    Tryed also a value of k=11000, doesn't help. (have IE11)

    My code is now:

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            WebBrowser1Adres = "https://familysearch.org/ark:/61903/3:1:3QS7-99Q8-PCWD?i=1&cat=2555205"
            Dim k = 11000
            Dim n = My.Application.Info.AssemblyName
    
            Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".exe", k)
            Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".vshost.exe", k)
            Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".exe", k)
            Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".vshost.exe", k)
    
            'WebBrowser1.ScriptErrorsSuppressed = True                                                   'suppress script-errors
            WebBrowser1.Navigate(WebBrowser1Adres)
        End Sub
    Any idea?

    Sunday, March 12, 2017 8:39 PM
  • Maybe the lines that contain “Wow6432Node” are not appropriate for your system if it is a 32-bit one. Then remove them.

    Or try determining the location of the problem. For example, put a breakpoint at the beginning of Form_Load using <F9>, then start it. Then continue investigations using <F10>.

    You can also write the values manually using “Regedit” system tool; (n — the name of your program or project).

    Monday, March 13, 2017 5:37 AM
  • Thanks for your patience. Forgot to tell that the warning comes on the first Registry.SetValue.

    Have fixed it manually, as you suggested, but only for the first 2, since I don't find an entry in the Wow6432 for Internet Explorer there. Or should I add them too?

    I noticed also that the MAIN is written as Main: is this important?

    Having done this (only for the first 2), the problem stays similar: lots of script-errors coming on in an endless loop, the retrieved web-page says: File not found and gives the warning: Attention: This site does not support your current browser...

    When I load the web-page with IE11 (normally I use Firefox), the page is displayed OK, but sometimes with a script-error.

    Please comment.

    Monday, March 13, 2017 9:10 AM
  • OK, I did the 4 fixes manually (with 10000 as well as 11000), but still the same problem: are not able to download the web-page: lots of script-errors coming on in an endless loop, the retrieved web-page says: File not found and gives the warning: Attention: This site does not support your current browser...
    I wonder if this is really the problem: I use a pretty new ACER i5 computer, running on Windows 10 home. The only version of Internet Explorer  I find  is 11.

    I use Visual Basic of Visual Studio 2015.

    Any suggestion?

    Tuesday, March 14, 2017 4:25 PM
  • Still not working. What I did till now:

    Manually set the Registry entries as explained in last reply. Tested the values 10000, 11000 and 11001.

    Put some extra lines in the code:

    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1Adres = "https://familysearch.org/ark:/61903/3:1:3QS7-99Q8-PCWD?i=1&cat=2555205"
        InitializeComponent()
        WebBrowser1.ObjectForScripting = True
        'WebBrowser1.ScriptErrorsSuppressed = True
        WebBrowser1.IsWebBrowserContextMenuEnabled = True
        Dim versie
        versie = WebBrowser1.Version
        WebBrowser1.Navigate(WebBrowser1Adres)
        'WebBrowser1.Navigate("http://info.uwe.ac.uk/online/blackboard/technical/test.asp")
    End Sub

    To see the version used by the browser I added 2 line: WebBrowser.Version returns: {11.0.14393.693} as expected.

    What else can I do, making it working?

    Thursday, March 16, 2017 5:59 PM
  • Hi, just to say that my program is working now: I had to do 2 things:

    1. As suggested above: force the WebBrowser to use the IE11 features with the following code:

    Dim k = 11000
    Dim n = My.Application.Info.AssemblyName
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".exe", k)
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".vshost.exe", k)
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".exe", k)
    My.Computer.Registry.SetValue("HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", n + ".vshost.exe", k)

    2. To copy the complete html-page with table: you need to do a "select all" before you can work with it. Since the WebBrowser doesn't have a "select all" function, you can do it in this way:

    WebBrowser1.Document.ExecCommand("SelectAll", True, vbNull)
    WebBrowser1.Document.ExecCommand("Copy", True, vbNull)
    ' Declare an IDataObject to hold the data returned from the clipboard.
    ' Retrieve the data from the clipboard.
    Dim iData As IDataObject = Clipboard.GetDataObject()
    TextBox1.Text = iData.GetData(DataFormats.Html)

    These 2 fixes solved my problem.

    Willy

    • Marked as answer by WilTro Friday, April 07, 2017 1:56 PM
    Friday, April 07, 2017 1:56 PM