Defining web object using Tree Model
Hi,
If name mapping is already present for a web object, can we still define the same web object using Tree Model? When I tried this, the object is not getting identified.
The way I defined the web object was by using Object Spy. I identified the web element and then copied the Full Name and assigned this to a variable and passing the variable in the script to perform actions.
Note: This web element is already having the Name Mapping.
Example code snippet (JS):
var obj = Sys.Browser("edge").Page(url).Form(formName).Panel(2).Panel(0).Panel(3).Panel(0).Textbox(txtBoxID);
obj.SetText(text); //Object wasn't getting identified.
When I replaced the contents on obj with the Mapped Name, it worked perfectly fine.
You can access objects both ways... either using the Sys.Browser way or Aliases.Browser... Why you wouldn't want to use NameMapping if you have it mapped, not sure I understand your ultimate goal here.
My guess is that you probably have something wrong in the values you're using for url or formName or txtBoxID. Keep in mind that NameMapping has all those values already in place. NameMapping also has built object identification waiting going on. So, I'm expecting that you might also be dealing with a timing issue where the object is not present at he time you're attempting to use it.
There should be no problem with using a NameMapping from one machine to another. The mapping is based upon objects within the application under test, their properties, and their hierarchy within that application. There should be VERY few factors in mapping that will cause a NameMapping that works on one machine to fail on another.