Reputation: 21
I am trying to mouse hover on some element using Robot Framework's keyword Mouse Over but I get error as "javascript error: Disallowed method "elementsFromPoint" on ShadowRoot.". Other Keyword like Click Element is working for the same element. But when I try to mouse hover, it throws me the above error. I am not sure how to resolve this error. Can anyone please help me to resolve this issue.
Upvotes: 1
Views: 2134
Reputation: 1
This is a bug that was introduced from chrome driver version 90. Here is a defect tracking this issue: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3791
Actions class methods like moveToElement,dbclick etc seems to be broken from chrome driver version 90. Especially when the elements are in shadow DOM parents.
I recommend downgrading to chrome browser 89 with chromium 89(to prevent auto update) Chromium 89.0.4350.6 chromedriver 89
Upvotes: 0
Reputation: 1338
I got the same problem while clicking on a Salesforce button. JavaScript workaround basesed on nobyk's solution worked so far.
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
javascriptExecutor.executeScript("arguments[0].focus(); arguments[0].click()", element);
Upvotes: 0
Reputation: 101
For ChromeDriver 90 and newer, you can use dispatchEvent()
like following.
var javaScriptExecutor = (IJavaScriptExecutor)webDriver;
javaScriptExecutor.ExecuteScript("arguments[0].dispatchEvent(new MouseEvent('mouseover', {'bubbles': true }));", element);
Upvotes: 0
Reputation: 1
According to https://github.com/salesforce/lwc/issues/2333#issuecomment-848378833 the workaround is to downgrade ChromeDriver.
Upvotes: 0
Reputation: 121
This just appeared for me as well due to some recent update from SalesForce and their tooltips. What I would recommend is to wrap the action in a Try/Catch and then try the alternate approach below.
What I did was to get the parent of the element - which is likely some descriptive text - click the parent to give it the focus, and use sendkeys TAB to activate the Tooltip.
Since this is wrapped in a Try / Catch, if SalesForce chooses to roll back this change, there will be no further maintenance required.
BY the way I tried a bunch of JavaScript solutions arguments[0].focus() arguments[0].fireEvent('onmouseover') and I could not get any to work.
Also you may find as I have that running tests on a headless Chrome browser on Linux renders the Action mouse and click actions useless.
> Blockquote
try {
actions.moveToElement(element, 5, 5).perform();
} catch (Exception e) {
//Alternate to activate an 'i' help hover
WebElement parent = element.findElement(By.xpath(".."));
click(parent);
}
Upvotes: 1