Forum Discussion
Thank you.
set page1 = Sys.Browser("chrome").Page("*").Panel(0).Panel(0).Panel(0).Section("content").Panel(1).Panel("applicantForm").Panel(0).Form("ttt").Panel(0).Panel(0).Panel(7).Panel(0).Panel(0)
panelobj = page1.Child(0).Name
set page2 = page1.panelobj
Im using like the above to find the Panel name. Here panelobj returns the correct name of the object.
But page2 always returned as Non-existent object. Is there a reason for this?
- tristaanogre7 years agoEsteemed Contributor
Yes, the reason being is that there is no such thing as page1.panelobj. panelobj is just a string. If you want, specifically, the object you can just have
set page1 = Sys.Browser("chrome").Page("*").Panel(0).Panel(0).Panel(0).Section("content").Panel(1).Panel("applicantForm").Panel(0).Form("ttt").Panel(0).Panel(0).Panel(7).Panel(0).Panel(0) panelobj = page1.Child(0)
Now panelObj is whatever Child(0) is.
However... this is not necessarily going to always return the same object if Child(0) ends up being something different sometime. Even if you went ahead with grabbing the name, again, that's no guarentee. The better solution, as mentioned, is either to map your objects using ObjectType coupled with something static like caption, value, idStr, etc. I use className for a lot of my mappings.
If you don't want to use NameMapping, then FindChild is your next bet... and that also uses the same type of criteria of finding an object based upon a set of properties. Either of these two methods are "best practice" when attempting to find or identify an object.
Related Content
Recent Discussions
- 14 hours agodhundley