javaleanft

LeanFT open browser window and navigate


I recorded a test case with Test Recorder tool in LeanFT with Chrome. When I execute it, it opens a new tab in Chrome, instead of starting a new instance of application. I tried to execute it in Firefox, but in this case it just opens browser window, doesn't navigate to given url.

    Browser browser = BrowserFactory.launch(BrowserType.FIREFOX);
    browser.navigate(env.LOGIN);

Error message:

com.hp.lft.sdk.GeneralLeanFtException: launch browser timeout occurred


Solution

  • When you execute a test, it's a new session.

    This means that it's your responsibility to make sure that the environment in which your code is running is appropriate.

    If you use .launch

    As you can see, the same method causes different behavior, depending on the browser and the state of the environment during the execution.

    You need to adapt depending on your needs, and decide whether you want to .launch a browser or .attach to one.