Selenium Safari"未知命令"

时间:2016-09-28 11:22:34

标签: java selenium safari

我正在使用Safari浏览器,但我遇到了问题。

"Unknown command: {"id":"5qhlf8uni92m","name":"mouseMoveTo","parameters":{"yoffset":25,"xoffset":10}} 
  

(警告:服务器未提供任何堆栈跟踪信息)"

我该如何处理?

注意:在我的方案中, f book 会显示一个通知弹出窗口,我无法选择任何元素,因为当弹出窗口显示时,黑色屏幕出现,我必须点击任何地方启用元素。这就是我使用此代码的原因;

WebElement knownElement = null; 
Actions builder = new Actions(driver);
builder.moveToElement(knownElement, 10, 25).click().build().perform();

在我看来,它会导致这个问题。如何更改此代码以适合Safari?

1 个答案:

答案 0 :(得分:0)

Please Refer this link : https://ynot408.wordpress.com/2011/09/22/drag-and-drop-using-selenium-webdriver/

OR : 

        public boolean onMouseOver(WebElement element){
            boolean result = false;
            try{
                String mouseOverScript = "if(document.createEvent){
                var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseover',
    true, false); arguments[0].dispatchEvent(evObj);
} else if(document.createEventObject){
 arguments[0].fireEvent('onmouseover');}";
                JavascriptExecutor js = (JavascriptExecutor) driver;
                js.executeScript(mouseOverScript, element);
                result = true;
            }catch (Exception e){
                e.printStackTrace();
                result = false;
            }
            return result;
        }