Skip to main content

VisualLocatorSettings type

Use the fields of this object to defined the locator names and whether all instances should be found or only the first.

firstOnly property​

Syntax​

let names_A = ["locator_1a", "locator_1b", "locator_1c"];
let locRegions5 = await eyes.locate({
settings: { locatorNames: names_A, firstOnly: true },
});

Type: boolean

Example​

JavaScript

//return a zero or one locator for each of the three locators defined as parameters to name()
let locRegions8 = await eyes.locate( {settings : {locatorNames:["locator_a","locator_b","locator_b"],firstOnly:true}});

//return all the locator found for the locators defined in the lists passed to names() or Strings passed to name()
let locRegions9 = await eyes.locate( {settings : {locatorNames:["locator_a","locator_b","locator_b"],firstOnly:false}});
//loop through all the locators and click on the center of their region
for (let locator in locRegions9) {
let regionArray = locRegions9[locator];
for (let region in regionArray) {
click(region.x + region.width/2, region.y + region.height/2);
}
};

locatorNames property​

Syntax​

obj = { locatorNames: [value1_string, value2_string] };

Type: string[]