Handling multiple selectors for same object
My web app has a grid. I can switch views and the table shows different data.
I want to map the objects in the first row for each column in the grid for both views.
Currently, I have one object that has two selectors depending on the view:
(//div[@col-id="PolygonDescription" and @role="gridcell"])[1]
(//div[@col-id="TrackingNumber" and @role="gridcell"])[1]
function test() {
//Log Tracking Number
Log.Message(NameMapping.Sys.browser.pageCenterView.panelTrackNum.contentText);
//Switch to other tab
NameMapping.Sys.browser.pageCenterView.buttonTabManifestlistTerritory.Click();
//Log Description
Log.Message(NameMapping.Sys.browser.pageCenterView.panelTrackNum.contentText);
}
This is currently working but it's little slow because it's trying to find the first selector first.
My question is, is there a better way to handle this?
If they share the same parent, then you can specify OR in the name mapping. For example,
Or combined the XPath,
Swap the ordering of your selector to suit your needs. You can also adjust the playback auto-wait timeout in code via Options e.g. Options.Run.Timeout = 1000;