This is the solution with visionLimitSearchArea
(V6.2.2, available soon).
You can use XPath locator to limit the image search the area of the slider you need, and then
XClick |
finds the correct slider. The x/y of this point is stored in ${!imagex},${!imagey}
.
The advantage compared to the @0.8#3 method is that any image after visionLimitSearchArea searches only search this small area. So this solution is faster.
{
"Name": "slider1",
"CreationDate": "2021-4-29",
"Commands": [
{
"Command": "open",
"Target": "https://ionicframework.com/docs/v3/demos/src/range/www/?production=true&ionicplatform=ios",
"Value": "",
"Description": ""
},
{
"Command": "click",
"Target": "xpath=/html/body/ion-app/ng-component/ion-nav/ng-component/ion-content/div[2]/ion-list[3]",
"Value": "",
"Description": "WARMTH slider. The Click command is NOT needed. We used it only to get the right XPath"
},
{
"Command": "comment",
"Target": "click // xpath=/html/body/ion-app/ng-component/ion-nav/ng-component/ion-content/div[2]/ion-list/ion-item",
"Value": "",
"Description": "Test Xpath of BRIGHTNESS Slider area"
},
{
"Command": "comment",
"Target": "visionLimitSearchArea // element:xpath=/html/body/ion-app/ng-component/ion-nav/ng-component/ion-content/div[2]/ion-list[1]",
"Value": "",
"Description": "Limit image search to BRIGHTNESS Slider Area"
},
{
"Command": "visionLimitSearchArea",
"Target": "element:xpath=/html/body/ion-app/ng-component/ion-nav/ng-component/ion-content/div[2]/ion-list[3]",
"Value": "",
"Description": "Limit image search to WARMTH Slider Area"
},
{
"Command": "XClick",
"Target": "ball_dpi_170.png",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "Starting point: x=${!imagex} y=${!imagey}",
"Value": "green",
"Description": ""
},
{
"Command": "XMove",
"Target": "${!imagex},${!imagey}",
"Value": "#down",
"Description": ""
},
{
"Command": "store",
"Target": "${!imagex}",
"Value": "x",
"Description": ""
},
{
"Command": "store",
"Target": "${!imagey}",
"Value": "y",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number (${x}) +100",
"Value": "x",
"Description": ""
},
{
"Command": "XMove",
"Target": "${x},${y}",
"Value": "#up",
"Description": ""
}
]
}