1

Can i use variable value in the element description?

For Example , I have a variable "UserId" and I want its value to be included in the element description which gives a detailed view in the QAF report.

Is this possible in QAF , any help is much appreciated.

user861594
  • 5,733
  • 3
  • 29
  • 45

1 Answers1

0

Use parameter in locator and then you need to set property before you create element object. For example:

Locator:

user.name.txtbox={'locator':'css=#userName';'desc':'User name for ${userID}'}

Java:

getBundle().setProperty("userID","u12345");
$("user.name.txtbox").sendKeys("Test User");

Example with page:

getBundle().setProperty("userID","u12345");
UserPage userPage = new UserPage();
userPage.getUserName().sendKeys("Test User");

** BDD**:

Given store "u12345" into "userID"
Then send Keys "Test User" into "user.name.txtbox"

If userId is same for entire execution, instead of setting through code you can set it using one of the way to set property.

user861594
  • 5,733
  • 3
  • 29
  • 45