.perform() 不适用于 Cataline safari 13.1 Browserstack

问题描述

我想在下面给出的 xpath 元素上移动光标,以便我可以验证颜色更改,但出现以下错误:org.openqa.selenium.interactions.MoveTargetoutOfBoundsException:

WebElement ele = browser.driver.findElement(By.xpath("(//li/a[contains(@class,'gn__cta')])[1]"))

((JavascriptExecutor) browser.driver).executeScript("window.scrollBy(2900,0)",ele)

Actions action = new Actions (browser.driver);

    webdriverwait wait = new webdriverwait(browser.driver,50);
    WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("(//li/a[contains(@class,'gn__cta')])[1]")));
    ((JavascriptExecutor) browser.driver).executeScript("arguments[0].scrollIntoView(true);",element)
    sleep(10000)
    action.movetoElement(element).click().build().perform()

尝试使用 moveByOffset() 函数结束了同样的错误

action.movetoElement(browser.driver.findElement(By.xpath("(//li/a[contains(@class,'gn__cta')])[1]")),0).clickAndHold().moveByOffset(0,100).release().build().perform();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)