簡體   English   中英

如何確保元素不可見並在量角器中繼續處理下一個條件

[英]How to make sure that the element is not visible and proceed with the next conditions in protractor

我正在測試一個元素,當用戶選擇一個單選按鈕時,加載圖像將出現在中間,並在幾秒鍾后不可見。 當加載圖像消失時,它將顯示登錄屏幕並執行所有其他條件。 下面是我的量角器代碼:

it('Displays the small login screen', function () {
    var loadpanel = element(by.id("loadingimage"));
    var el = loadpanel;
    browser.driver.wait(protractor.until.elementIsNotVisible(el));
    smallLogin = element(by.id('loginScreen'));
    browser.wait(EC.presenceOf(smallLogin), 30000);
    expect(smallLogin.isPresent()).toBe(true);
    element(by.id('dropdown')).click();

這不起作用,但是通過了。 我希望隱藏正在加載的圖像,直到可見為止,不應執行小的登錄條件。 發生的情況是,它執行小的登錄條件,並且還單擊下拉菜單,同時圖像仍然可見。 謝謝。

您要使用的期望條件是invisibilityOf

var EC = protractor.ExpectedConditions;

// select a radiobutton 

var loadpanel = element(by.id("loadingimage"));
browser.wait(EC.invisibilityOf(loadpanel), 5000);

var smallLogin = element(by.id('loginScreen'));
expect(browser.isElementPresent(smallLogin)).toBe(true);

element(by.id('dropdown')).click();

同樣,在類似情況下,在測試內部Angular應用程序時,我還記得還必須在測試之前將ignoreSynchronization設置為true然后在測試之后將其設置為false ,以便捕獲應用程序的“加載”狀態。

暫無
暫無

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

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