new Actions(data).moveToElement(element,x,y).perform();
org.openqa.selenium.interactions.MoveTargetOutOfBoundsException
With Chromedriver's switch to w3c compliance in version 75, you now have to scroll any elements into view before using actions on them
private boolean isVisibleInViewport(WebElement element) {
return (boolean)((JavascriptExecutor)data).executeScript(
"var elem = arguments[0], " +
" box = elem.getBoundingClientRect(), " +
" cx = box.left + box.width / 2, " +
" cy = box.top + box.height / 2, " +
" e = document.elementFromPoint(cx, cy); " +
"for (; e; e = e.parentElement) { " +
" if (e === elem) " +
" return true; " +
"} " +
"return false; "
, element);
}
public void moveToElement(WebElement element, int x,int y){
if (!isVisibleInViewport(element)) ((JavascriptExecutor) data).executeScript("arguments[0].scrollIntoView();", element);
new Actions(data).moveToElement(element,x,y).perform();
}
org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: move target out of bounds
(Session info: chrome=75.0.3770.100)
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'TEST_VIRTUAL_114', ip: '192.168.215.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 75.0.3770.100, chrome: {chromedriverVersion: 75.0.3770.90 (a6dcaf7e3ec6f..., userDataDir: C:\Users\TestVirtualPC\AppData\Lo...}, goog:chromeOptions: {debuggerAddress: localhost:63560}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3a95f647-de9f-42e4-96bf-f155152130e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.