I'm 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 get printed in console desired text.
How to execute this directly in console?
When I add breakpoint on expect
line 6 the part console.log(text);
is not printed and I receive this output in console when I try to get elem text:
> title.getText()
< ElementFinder
> title.getText().then(function (text)
{
console.log(text);
});
< ManagedPromise
Is is possible to find elements and print it properties in debug console?
Selenium commands are executed asynchronously, which implies that all the calls are queued and are not yet executed if you stop the execution on the expect line.
Moreover it's probably not possible to get the properties from the console. For instance calling .getText()
in the console will queue the call but it won't be executed since the control flow is not running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With