The transporter verifies that the item is empty.

<div id='messagesDiv'></div>

I want to check that this div element is empty.

 var messagesDiv = element(by.id('messagesDiv')); expect(messagesDiv).to... 

How do I achieve this?

+5
source share
3 answers

I think:

 expect(messagesDiv.getText()).toBe(''); 

gotta do the trick. More details here .

+5
source

Try

 expect (messagesDiv.text).toBe('') 
0
source

expect(messagesDiv.getText()).toMatch(/^\s*$/); will handle spaces, tabs, line breaks, etc. that HTML treats as empty, but may actually not be in raw HTML.

0
source

Source: https://habr.com/ru/post/1233479/


All Articles