Cadet 3rd Class
Cadet 3rd Class
610 views

Silk Central Error : java.lang.RuntimeException: No application configuration present.

Hi,

I am facing an error in Silk Central " java.lang.RuntimeException: No application configuration present." when i am running an keyword driven test of type silk4j

Steps"

  1. My java function start_application() is running fine when i am running from my local eclipse- Run as Keyword driven test. Before i ran this test i have setup Chrome as Browser in Silk4J "Edit Application Configuration" section.
  2. Then i upload this lib to Silk Central and ran a keyword driven test.
  3. Faced an error in Silk Central: java.lang.RuntimeException: No application configuration present. Seems it's not get the "Dialog" box at first line from my code which i have found from error stack trace
    10/08/2018 +0530 17:35:51.372 	at xx.xx.xx.login.xxxxxx.start_application(xxxx.java:39)
  4. Then I removed the yellow highlighted code and upload the Lib again to Silk Central and it worked fine.

My requirement is that i have to close all browser and open a new browser before start test. Can someone please share some thought on this.

My java class

    private Desktop desktop = new Desktop();

    @Keyword(value = "Start", isBaseState = true)
    public void start_application() throws IOException {
       
        //close all browser component on following order and start new browser
    
        List<Dialog> dlgs = desktop.<Dialog>findAll("//Dialog");
        List<BrowserApplication> bAs = desktop.<BrowserApplication>findAll("//BrowserApplication");

        dlgs.stream().forEach(d -> d.closeSynchron());
        bAs.stream().forEach(b -> b.closeSynchron());

        List<Window> wnds = desktop.<Window>findAll("//Window");
        wnds.stream().forEach(w -> w.closeSynchron());

        //BrowserBaseState baseState = new BrowserBaseState("silk4j.settings");
        BrowserBaseState baseState = new BrowserBaseState();
        baseState.setBrowserType(BrowserType.GoogleChrome);
        baseState.setConnectionString(
                  "chromeOptions="
                  + "{"
                  + " \"prefs\": {"
                  + "              \"profile.default_content_setting_values.automatic_downloads\":1,"
                  + "              \"download.default_directory\":\"C:\\\\Users\\\\XXXXX\\\\Downloads\\\\Silk4JDownload\","
                  + "              \"download.prompt_for_download\":false"
                  + "            }"
                  + "};");
         baseState.execute(desktop);

 

Thanks,

Silk4j

0 Likes
1 Reply
Absent Member.
Absent Member.

Hi,

BrowserBaseState.execute() should be called at the very beginning of the test - otherwise the browser is not controlled by SilkTest and cannot be closed (when running locally, the browser is already hooked by the SilkTest OpenAgent).

Remove the yellow code and start the test with new BrowserBaseState()...

If you need to make sure, the browser is not running before you start the test, I would use a Setup Test to do so. Use a ProcessExecutor Test to shutdown any running browser (e.g. > taskkill /F /IM chrome.exe /T ).


Regards,
Matthias
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.