I have an HTML snippet as follows:
...
<div class="show-div account">
<ul >
<li>
<a href="/account/login">Login</a>
</li>
<li>
<a href="/account/register">Register</a>
</li>
</ul>
</div>
...
I'd like to check whether the login page is clicked once the Login button is clicked. What I understood from the docs, the following should work but it won't.
const loginAction = await accountIcon.element(by.className('show-div')).$('ul').$$('li').filter(async function(elem) {
const a = elem.element(by.css('a'));
const attr = await a.getAttribute('href');
return attr.includes('/account/login');
}).first().$('a');
await loginAction.click();
const url = await browser.getCurrentUrl();
expect(url).endsWith('/account/login');
I'm using "protractor": "7.0.0" with Angular 10. Those are auto-generated by the JHipster framework. I'm not sure whether I need to use async/await
mechanism. Considering the ElementFinder
API, I should but most of the examples do not utilize it.
(BTW, SELENIUM_PROMISE_MANAGER is disabled)
I'd appreciate any help. Thanks in advance.