Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74325

TestCafe cant find a element if the text contains a space

$
0
0

I have the next code that asserts if I can find a bank account in a cell. I found out that it's not working when the text in the cell contains a space after the text.

    this.bankAccounts = Selector('td[data-cy="listAccountNumber"]');

async checkBankAccount(accountNumber, currencyCode, name){
    const formatedAccount = formatBankAccount(accountNumber, currencyCode);
    const bankCell = Selector(this.bankAccounts).withText(formatedAccount);

    await t
        .expect(bankCell.exists).ok("Should create: " + name +
            " bank. Could not find bank: " + formatedAccount);
}

For example, the previous method won't find the next cell if given accountNumber "CY25 7121 9716 3791 8645 3263 6242"

<td data-cy="listAccountNumber">CY25 7121 9716 3791 8645 3263 6242 </td>

But it will find it if my cell was like:

<td data-cy="listAccountNumber">CY25 7121 9716 3791 8645 3263 6242</td>

Viewing all articles
Browse latest Browse all 74325


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>