[英]Actions class operations inside iframe(Java-Selenium)
I am Currently inside a iframe and I am trying to perform Click and Right Click Operations using Actions class.我目前在 iframe 中,我正在尝试使用 Actions 类执行单击和右键单击操作。 At the time of executing the script the click and Right click operations are performed on the incorrect elements(Operations are performed on the elements below the Expected Elements).在执行脚本时,对不正确的元素执行单击和右键单击操作(对预期元素下方的元素执行操作)。 The locators that I am using are correct.我使用的定位器是正确的。
How do I perform Click and Right Click operations inside a iFrame using Actions Class or do we have an alternate way如何使用 Actions 类在 iFrame 内执行单击和右键单击操作,或者我们是否有另一种方法
Code:- I have switched to the iframe代码:- 我已切换到 iframe
**Click Operation:-**
Actions actions = new Actions(driver.get());
actions.moveToElement(wait.get().until(ExpectedConditions.elementToBeClickable((By.xpath(currentObject)))));
Thread.sleep(2000);
actions.click();
actions.build().perform();
**Right Click Operation:-**
Actions actions = new Actions(driver.get());
actions.moveToElement(wait.get().until(ExpectedConditions.visibilityOfElementLocated(By.xpath(currentObject))));
actions.contextClick();
actions.build().perform();
您是否将驱动程序切换到正确的框架?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.