How to click at specific coordinates?

No clue why but ran it two more times and it worked this time. Will try adding the variable statement to -2 next.

Holy crap yes! It worked! Now I just have to do this about 10 more times and I can make it through these darn options… You are awesome!

So I am running the same thing for a different object and running into the same issue with the comment not running.

WebUI.click(findTestObject('Object Repository/Button Layers/Layer Views (Filter To Lines)'))
TestObject to1 = findTestObject('Object Repository/47.) Northern/Layer View Options/Filter Line Selection (Line 1)')
myItem1 = WebUI.findWebElement(to1,10)
WebUI.comment("Current position is ${myItem1.getLocation().getX().toString()} and ${myItem1.getLocation().getY().toString()}")
xResult = myItem1.getLocation().getX() - 1;
yResult = myItem1.getLocation().getY() - 1;

WebUI.comment("Calculated amounts are: ${xResult } and ${yResult}")
WebUI.clickOffset(to1, -xResult, -yResult, FailureHandling.STOP_ON_FAILURE)

Again, it’s possible the ā€œintegersā€ don’t set well within the Comment String, so add the toString() onto the integers to resolve the issue.

WebUI.comment("Calculated amounts are: ${xResult.toString()} and ${yResult.toString() }")
1 Like

So kinda weird but, it will work either way so long as the case is started from the beginning. If I start anywhere else in the script the comments will fail.

You can either define the variables in the Variable tab or put the Comment statements in a try / catch block with a message like:

try {
    WebUI.comment("Calculated amounts are: ${xResult.toString()} and ${yResult.toString() }")
} catch (Exception) {
    WebUI.comment("Calculated amounts are: xResult (undefined) and yResult (undefined)")
}

The Comment statements are for you and not really needed after you get it working.