当我使用moveToElement时,出现错误" org.openqa.selenium.interactions.MoveTargetOutOfBoundsException:元素内的偏移无法滚动到视图中:(0,0):命令持续时间或超时:34毫秒".下面的代码用于此
When I am using moveToElement, I am getting an error "org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: Offset within element cannot be scrolled into view: (0, 0): Command duration or timeout: 34 milliseconds". Below code is used for that
WebDriverWait waitForEditI = new WebDriverWait(driver, 20); waitForEditI.until(ExpectedConditions.elementToBeClickable(editContactI)); Actions action = new Actions(driver); action.moveToElement(editContactI).moveToElement(editContactIEdit).click().build().perform();和网络元素是
@FindBy(how = How.CSS, using = "div#evy_aboutme_content_id08 div.evy_edit_overflow > div.evy_rltn_icon2 i") WebElement editContactI; @FindBy(how = How.CSS, using = "div#evy_aboutme_content_id08 div.evy_aboutme_education_content.ng-scope a:nth-child(1)") WebElement editContactIEdit;如下图所示,首先我需要将i元素(标记为黄色圆圈)悬停并单击编辑(黑色圆圈).
As the below image, first I need to hover i element (which is marked in yellow circle) and click the edit (black circle).
我尝试了以下所有选项.但是没有任何效果.它的位置是动态的.
I have tried all below options .But nothing is working. The position of it is dynamic.
JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("scroll(250, 0)");和
Actions actions = new Actions(driver); actions.keyDown(Keys.CONTROL).sendKeys(Keys.END).perform();请帮助我.
推荐答案如果在IE浏览器中遇到上述异常.请按照以下步骤操作:
if you are getting the above mentioned exception in IE browser. Please follow the below steps:
最后再次运行您的代码,现在您应该不会看到此错误. :)
Finally run your code again and now you should not see this error. :)
更多推荐
如何处理"MoveTargetOutOfBoundsException"在Selenium WebDriver中
发布评论