Tips & tricks - Web testing

Work with the Web SDK

Make sure you include:

C#: using HP.LFT.SDK.Web;

Javaimport com.hp.lft.sdk.web.*;

JavaScript: var Web = LFT.Web;

Back to top

Use the Object Identification Center (OIC) with Web objects

Open your browser only after the LeanFT runtime engine is running.

If you are using LeanFT with Microsoft Edge, you must open the browser session with the Edge Agent for Functional Testing, accessible from the Start menu.

Back to top

Declare your browser in your test

Even if you are working with objects from an application model, declare your browser in the context of your test and then pass the browser as an argument when you instantiate your application model class:

Back to top

Decide which browser to use for your Web steps.

  • Use the Launch method to open a new browser.
  • Use the Attach method to run your steps on an open browser tab (or one that was opened by your application during the session).

Back to top

Describe objects using XPath or CSS expressions

Use the XPathDescription and CSSDescription classes when it would be difficult to uniquely describe an object using properties and values.

The Object Identification Spy automatically generates suggested values that you can use for the XPath and CSSSelector properties.

Note:  

  • Keep in mind that XPath and CSS values are ordinal and can be more complex to maintain as your application changes over time.

  • If two objects on a page have the same value for their id attribute, the XPath values generated for those objects may be identical.

Back to top

See also: