Asserting an element is focused

后端 未结 7 862
傲寒
傲寒 2020-12-16 18:50

According to the How do I assert an element is focused? thread, you can check if an element is focused by switching to an activeElement() and assert this is the

7条回答
  •  囚心锁ツ
    2020-12-16 19:42

    You can simply check the text (or anything else) of the element:

    var currentElement = browser.switchTo().activeElement();
    expect(currentElement.getText()).toEqual(page.element.getText());
    

提交回复
热议问题