Created On:  01 November 2011

Problem:

Can scripts be recorded with both Internet Explorer and Firefox?

Resolution:

While the same script can playback against both browsers, you can only record scripts against Internet Explorer. If you try to record against Firefox it should prompt you with an alert message.

How do you go about playing back on both web browsers?

1. Create a script that was recorded against IE
2. In the Properties > Application Configuration change the setting to match FireFox. Click ‘Select Application’ to choose FireFox instead.
3. Now this script can be run via FireFox.

Additionally, here is how to control the basestate in the script itself.

Imports SilkTest.Ntf.XBrowser

Public Module Main

Dim _desktop As Desktop = Agent.Desktop

Public Sub Main()

        Dim sStateFireFox As BaseState

        sStateFireFox = New BaseState("c:\program files\Mozilla Firefox\firefox.exe","webBrowser",TechDomain.XBROWSER)

        sStateFireFox.Execute()

                                                            

        With _desktop.BrowserApplication("webBrowser")

        With .BrowserWindow("browserWindow")

              .Navigate("www.google.co.uk")

              .DomTextField("q").SetText("hello")

              .DomButton("btnG").Select()

              .Close()

        End With

        End With

                              

        Dim sStateIE As BaseState

        sStateIE = New BaseState("c:\program files\Internet Explorer\iexplore.exe","webBrowser",TechDomain.XBROWSER)

        sStateIE.Execute()

              

        With _desktop.BrowserApplication("webBrowser")

        With .BrowserWindow("browserWindow")

             .Navigate("www.google.co.uk")

             .DomTextField("q").SetText("hello")

             .DomButton("btnG").Select()

             .Close()

        End With

        End With

                              

    End Sub

End Module

Notes: You must be using a version of Firefox that is officially supported.  Please see product release notes for this type of information.  For example if you try to use Firefox 7, you won't be able to add Firefox7 to the application configurations. Typically you will get a message saying "Failed to get Locator".  By rolling back to a supported version it should work just fine.

Also it is important to note that newer versions of SilkTest Workbench may support newer versions of Firefox. It is highly recommended that you should also be running the latest version and build of STW (SilkTest Workbench) as it may likely offer stability and performance improvements over some of the previous releases/builds. If you have a valid license, you will be able to download the latest Silktest Workbench installation package from the following link: http://supportline.microfocus.com/websync/SilkTest.aspx (a web ID and valid serial number associated to the web ID are required to see the product).
 
If you still experiencing particular issues after making sure you running the latest public updates, please contact Micro Focus SupportLine to check if the issue may have been fixed in a later HotFix which is not yet been released to the general public.