0

I am facing issues in performing certain actions based on the value in the excel file cell data.

Actions like if value is "NORMAL" then click Container type = Normal (radio button)

Following is my excel sheet data

Examples of container types

Similarly the Unit Container Value

Unit Container screenshot

Following is my code:

enter image description here

I am getting this error while performing action .WebElement("Container_Type_Normal").Click

Invalid or unqualified reference error message

Motti
  • 110,860
  • 49
  • 189
  • 262

1 Answers1

0

Your error is because you can't start a line with . unless your within a with - and i can't see a with in your function. (i also don't recommend using a with as the can cause needless confusion)

The .webelement object is a catch-all type of object that is the child of other web objects or .page. You need this to be a full and valid path to the object, by this i mean start with browser().page().

You have a couple of options:

You can either make this a full path to your object based on the object repository:

Browser("<<OR Browser name>>").Page("<<OR Page name>>").WebElement("<<Your webelement name>>".click

For this, look at your OR and insert your names.

Or, option 2, you can use descriptive programming:

Browser("CreationTime:=0").Page("index:=0").WebElement("text:=" & fieldValue,"index:=0").click

That will take the browser that was created first (Creation time 0), the only page it has and the first (index 0) web element that contains your text (text is field value).

I'm assuming that you only have one browser, and that the first element that contains the text you want is what you want to click. You may need to add more layers too this or

A good approach is to mirror what is OR or use the object spy to ensure these properties are correct.

RichEdwards
  • 3,423
  • 2
  • 6
  • 22