Created On:  27 October 2011


Why may I encounter the error “WebBrowser does not define a tag for Microsoft Windows XP”?


This error has been known to occur if you are attempting to dynamically pass an XPath locator string to HTML DOM Class (e.g. DomListBox, DomButton etc) at runtime. The Dom classes are not designed to take an X-Path string locator as an input parameter, therefore although the following code snippet which may compile:

WebBrowser.BrowserWindow("//BrowserWindow").DomListBox("//SELECT[@id='quick-link:jump-menu']").Select("Auto Quote") 
at run time it will produce the error message "WebBrowser does not define a tag for Microsoft Windows.."

To resolve the error you have a number of options:

1) For SilkTest versions prior to SilkTest 2010 R2 you can use the Recorder to record the pressing of the button, this will result in the Find() method being generated. This method accepts an X-path locator string as an input parameter, like so:
Desktop.Find("//BrowserWindow//SELECT[@id='quick-link:jump-menu']").Select("Auto Quote") 
2) For SilkTest 2010R2 and onwards the Open Agent recorder will automatically build a frame file and you are also free to manually define the window declarations , like so:
BrowserWindow BrowserWindow
    Locator "//BrowserWindow")
      DomListBox ListBox1
        Locator “SELECT[id='quick-link:jump-menu’]”

Once you have done then you can then call the following in your test case:
WebBrowser.BrowserWindow.ListBox1.Select("Auto Quote")
Also if you record against the control but dont wish to update the frame file you can dynamically instantiate the object. This will use the .FindClass method (e.g. FindDomButton, FindDomCheckBox etc )

Incident #2509486