0

Im using visual studio 2017, and I have the leanft installed. The runtime engine is launched when I open the IDE. The 1st question is how can I launched the runtime engine programmatically using c#.

The next question centers around a situation where at runtime when I perform the code to attach the plugin to the chrome browser it sometimes times out doing the attachment. How can I handle this better. Basically my tests gets the chromdriver launches a browser and then at that time it will attempt to attach leanft plugin to the running browser. If it times out once in a blue moon, how can I wait for the browser before trying to attach leanft. See link below

Integrate leanft into selenium tests

user5199
  • 359
  • 2
  • 15

1 Answers1

0

how can I launched the runtime engine programmatically using c#

Engine launches when you initialize the SDK:

HP.LFT.SDK.SDK.Init(new HP.LFT.SDK.SdkConfiguration());

Make sure that if you do this manually, you also perform an SDK.Cleanup() at the end of the execution.

Details here (Custom Frameworks)

how can I wait for the browser before trying to attach leanft

  • You could try to see if there are any processes in the task list:

    From here: Process[] pname = Process.GetProcessesByName("notepad");

  • or perform browser.Attach for 2 or 3 times until it works (basically handle the Time Out exception)

  • Each time you try to do .Attach, the SDK will try to attach for 20 seconds (by default) using the provided description, you can extend that like this:

    HP.LFT.SDK.SDK.Init(new HP.LFT.SDK.SdkConfiguration() {
        ResponseTimeoutSeconds = 60
    });
    

    If you're not initializing manually, you'll find this setting in App.config file that comes when you create a LeanFT test using a provided template.

Adelin
  • 7,809
  • 5
  • 37
  • 65