javascriptui-automationgetgauge

How can i detect a button in taiko js


I'm trying to detect a button on my simple angular page. On checking that the button exists, it always returns false whilst the text search always return true.

console.log(await button('New Page').exists()); - false
console.log(await button(below('title')).exists()); - true
console.log(await text('New Page').exists()); - true

the html component looks a bit like this.

<button class="new-page-button" routerlink="/next" tabindex="0">
<span class="mat-button-wrapper"> New Page </span>
<div class="mat-button-ripple mat-ripple" matripple=""></div>
<div class="mat-button-focus-overlay"></div>
</button>

I would expect that the button function in taiko would be able to detect the button with text "New Page".

There isn't much help around this topic. Any help would be much appreciated.


Solution

  • Currently, taiko does not search for buttons which has child elements with matching text. There is an open issue for the same. Please follow https://github.com/getgauge/taiko/pull/833 to get updates on the issue.