Lieutenant Commander
Lieutenant Commander
372 views

How to accomodate both BaseState and Browser single silk4j.settings file?

Hi , I have a requirement where I launch rumba first and then launch internet explorer. I have used BaseState class for rumba and BrowserbaseState class for launching IE. My silk4j.settings file has base state info for IE. When I try to run the script I et the below error message. C:\Users\..\tests.jar\silk4j.settings' does not contain base state information that is compatible with the 'BaseState' class. Use the class 'BrowserBaseState' instead. How do I accommodate both the Basestate info in the silk4j.settings file? Regards, Raghavan.S
0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

Hi

What code are you using for the basestates in your script?

The error indicates that you have used BaseState while declaring the browser.

You need to use BrowserBaseState for a browser. For example:

BrowserBaseState iexplorer = new BrowserBaseState(BrowserType.InternetExplorer, "http://demo.borland.com");
iexplorer.execute(desktop);

 

Regards,

 

Senior Technical Support Engineer
UFT | UFT Mobile | Silk Test
Micro Focus
0 Likes
Lieutenant Commander
Lieutenant Commander

Hi ,

Yes , I have used BrowserBaseState for the browser and basestate for the Rumba application.Since the Rumba part gets executed first , I get an error saying the silk4j.settings has base state and not Browser Base State info.

1)

 

Regards,

Raghavan.S

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Hi @Raghavan_S 

You can simply create 2 .settings files, one with the Rumba basestate information and another with the Browser basestate information.

  1. Remove all existing application configurations from your Silk4J project
  2. Add an application configuration for Rumba
  3. Rename the silk4j.settings file to rumba.settings
  4. Return to the application configurations dialog, which should now be blank
  5. Click add application configuration and add the browser configuration
  6. A new silk4j.settings file will be generated with the BrowserBaseState information

In you code you can simply invoke each application as follows:

BaseState rumba = new BaseState("rumba.settings");
rumba.execute(desktop);

BrowserBaseState browser = new BrowserBaseState("silk4j.settings");
browser.execute(desktop);

The only other alternative, is to simply hardcode one of the base states per @Colin Moynes suggestion. For example, to launch Chrome:

BrowserBaseState chrome = new BrowserBaseState(BrowserType.GoogleChrome, "https://my-app-url");
chrome.execute(desktop);

 

I hope that helps.

-Robert

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.