簡體   English   中英

單擊后更改鼠標位置

[英]Change mouse position after click

public class FoodToFoodGroup {  driver.findElement(By.xpath("//*[@id='engage-create']//ul[@title='Message']/li")).click();
Thread.sleep(9000); 
WebDriverWait wait = new WebDriverWait(driver, 20); WebElement element = wait.until( ExpectedConditions.visibilityOfElementLocated(By.cssSelector("img#accordionIcon.accordionIcon.sprite"))); 
element.click(); }

我能夠單擊如圖所示的消息圖標,但是在鼠標仍然指向框架或框架本身沒有消失之后。 因此,我無法單擊其他元素。 圖片

為什么不將鼠標懸停在其他元素上,直到該幀消失。 如果要懸停在特定元素上,請使用此方法

public static void hoverToWebelement(WebElement HovertoWebElement) throws InterruptedException {
    //log.info("Hovering over an element");
    Actions builder = new Actions(driver);
    builder.moveToElement(HovertoWebElement).perform();
    Thread.sleep(2000);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM