本文介紹了如何單擊量角器中的隱藏元素?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我有一個元素,只有當我將鼠標懸停在它上面時才可見.
I have an element which is visible only when I hover over it.
我編寫了以下代碼來懸停在面板上,以便元素可見.
I've written following code to hove over the panel so that the element is visible.
ptor.actions().
mouseMove(ptor.findElement(protractor.By.xpath('//*[@id="productapp"]/div/div/div[2]/div/div/div/div[2]/div/div/div/div[4]/table/thead/tr/th[2]'))).
perform();
ptor.element.all(by.tagName('i')).then(function(elm){
elm[0].click();
});
現在我試圖點擊它,但它顯示 -ElementNotVisibleError:元素不可見量角器錯誤.
Now I tried to click on it, but it says - ElementNotVisibleError: element not visible error in protractor.
基本情況是,我想將鼠標懸停在面板上,然后單擊隱藏的元素,因為該元素在懸停之前是不可見的.
Basic scenario is, I want to hover over a panel and then click on the hidden element, because the element is not visible until it is hovered over.
推薦答案
以下代碼對我有用.
ptor.actions().
mouseMove(ptor.findElement(protractor.By.xpath('//*@id="productapp"]/div/div/di??v[2]/div/div/div/div[2]/div/div/div/div[4]/table/thead/tr/th[2]'))).perform();
ptor.element.all(by.css('i.ng-scope.tea-ic-sorting')).then(function(elm){
elm[0].click();
});
這篇關于如何單擊量角器中的隱藏元素?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!