Getting element not intractable error after setting the page zoom level

Hi there,
I am trying to zoom out the page and then perform actions like click on the button. But I am getting element not visible or interactable. I even tried to place delay and then have mouse move to x and y coordinates before clicking on the element, then I am getting moveTargetOutOfBounds error. Please find the snippet below.

WebUI.executeJavaScript(‘‘70%’’, null)
def location = driver.findElement(By.xpath("//div[contains(@class, ‘sub-navigation’)]/a[contains(text(),‘Careers’)]")).getLocation()
int locationX = location.x
int locationY = location.y
Actions action = new Actions(driver);
action.moveByOffset(locationX, locationY).perform()

Thanks in advance for your time in helping me.

There are issues when altering the document zoom level - it looks like you are hitting those.

It seems you are willing to use JavaScript in your test, so why not use JavaScript to click on your button/link? JavaScript doesn’t care about x/y coordinates…

Hi @Russ_Thomas, Thanks for the solution. it worked when I use the javascript to click the button. but after that even after I navigate to new page most of my scripts are failing to click using WebUI, mouse move to element using Actions, or mouseover using WebUI etc. Getting errors like element not visible, moveTargetOutOfBounds, IndexOutOfBounds etc. it seems like I need to redo most of my scripts or remove the zoom.

Not why the correct element locations are used when the page is loaded. I am assuming the elements in the dom should be reset to correct locations. Is something I am missing here