Protractor: prints the found properties of an element in the console during debugging

I am debugging protractor tests in Webstorm. When I add this code:

var title = element(by.xpath('//div[@class="title"]')); title.getText().then(function (text) { console.log(text); }); expect(title.getText()).toEqual('Opportunities'); 

I type in the desired console text.

How to do this right in the console?
When I add a breakpoint on the line expect 6, part of console.log(text); doesn't print, and I get this output in the console when I try to get elem text:

 > ‌‌title.getText() < ‌ElementFinder > ‌‌title.getText().then(function (text) { console.log(text); }); < ManagedPromise 

Can I find items and print their properties in the debug console?

+5
source share
1 answer

Selenium commands execute asynchronously, which means that all calls are queued and not yet completed if you stop execution on the waiting line.

Also, it may not be possible to get properties from the console. For example, calling .getText() in the console will result in a call queue, but it will not be completed because the control flow is not running.

+3
source

All Articles