久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

量角器單擊元素數組

Protractor clicking through an array of elements(量角器單擊元素數組)
本文介紹了量角器單擊元素數組的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我對 e2e 測試和使用量角器/jasmine 框架非常陌生.我知道如何獲取元素數組以及如何單擊錨點.但是如何/甚至可能點擊元素選擇器/中繼器返回的錨點列表?

I'm quite new to e2e testing and in using protractor / jasmine framework. I know how to get an array of elements and also how to click on an anchor. But how would / is it even possible to click through a list of anchors returned by a element selector / repeater?

我一直在嘗試各種方法,但作為一個例子(最新的一個還沒有被刪除,哈哈),這就是我得到的:

I've been trying various ways, but as an example (latest one which hasn't been deleted lol) this is what I got:

element.all(by.repeater('link in links')).then(function(links) {
    links.forEach(function(link) {

        link.click().then(function() {
            console.log('callback for click ');

        });
    });
});

這似乎采用了第一個元素并點擊通過,但是下一次迭代它掛起(我明白為什么,但努力想辦法解決 - 這是我需要采取的某種承諾和解決因素嗎?考慮?)

This appears to take the first element and click through, however come the next iteration it hangs (I can see why, but struggling to figure a way to resolve - is this some kind of promise & resolve factor i need to take into account?)

返回的錯誤是

失敗:過時的元素引用:元素未附加到頁面文檔

Failed: stale element reference: element is not attached to the page document

任何指導/幫助鏈接將不勝感激 - 到目前為止,谷歌搜索尚未向我返回任何值得注意的信息...

Any guidance / link to help would be appreciated - googling hasn't returned anything of note to me so far...

提前致謝!

推薦答案

設法找到解決方法,盡管感覺不太對.無論如何,如果有人有更好的建議,請隨時發布:)

Managed to figure a workaround, although this doesn't feel quite right. Anyway, if anyone has better suggestion feel free to post :)

element.all(by.repeater('link in links')).map(
    function(link, index) {
        return {
            index: index,
            href: link.getAttribute('href')
        };
    })
    .then(function(links) {
        for (var i = links.length - 1; i >= 0; i--) {
        browser.get(links[i].href);
        // do some page specific stuff here.
    };
});

這篇關于量角器單擊元素數組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I get my jasmine tests fixtures to load before the javascript considers the document to be quot;readyquot;?(在 javascript 認為文檔“準備好之前,如何讓我的 jasmine 測試裝置加載?) - IT屋-程序員軟件開發技術
What do jasmine runs and waitsFor actually do?(jasmine 運行和等待實際上是做什么的?)
How to provide mock files to change event of lt;input type=#39;file#39;gt; for unit testing(如何提供模擬文件來更改 lt;input type=filegt; 的事件用于單元測試)
How to unit test a chained method using Jasmine(如何使用 Jasmine 對鏈式方法進行單元測試)
How do I inject $rootScope into an AngularJS unit test?(如何將 $rootScope 注入 AngularJS 單元測試?)
Jasmine - How to spy on a function call within a function?(Jasmine - 如何監視函數中的函數調用?)
主站蜘蛛池模板: 午夜精品久久久久久久99黑人 | 亚洲国产精品人人爽夜夜爽 | 欧美在线一二三 | 欧美99| 国产欧美日韩综合精品一区二区 | 97久久精品午夜一区二区 | 成人网av| 国产成人精品久久二区二区91 | 91视频入口| 国产精品夜间视频香蕉 | 欧美888| 日韩高清国产一区在线 | 偷拍自拍网址 | 成人久久久 | 紧缚调教一区二区三区视频 | 蜜桃传媒av | 亚洲精品一二三区 | 国产精品久久久久久久久图文区 | 久久综合99| 国产欧美精品一区二区 | 午夜精品久久久久久不卡欧美一级 | 国产精品一区在线观看 | 四虎影院免费在线 | 亚洲精品久久久久久久不卡四虎 | 国产乱码精品一区二区三区五月婷 | 免费毛片网站 | 久久草在线视频 | 中文字幕1区 | 九九色综合 | 日本一本在线 | 久久www免费人成看片高清 | 国产三区精品 | 亚洲伊人精品酒店 | 91精品午夜窝窝看片 | 国精产品一品二品国精在线观看 | 午夜手机在线视频 | 久久午夜剧场 | 成人国产免费视频 | 国产www成人| 国产精品揄拍一区二区久久国内亚洲精 | 久久免费看 |