Herawati Manurung
Herawati Manurung

Reputation: 5

How to click element in parent class using TestCafe?

I want to typetext on textarea with parent class that marked on this following img Snippet code I want to use that class because id on textarea is dynamic element and will change every loaded. That's why I use parent class. I use

let textArea = Selector('.block-card list-group-item text-card col-xs-12').find('textarea') await t .typeText(textArea, 'Hai...')

But got error:

The specified selector does not match any element in the DOM tree.

> | Selector('.block-card list-group-item text-card col-xs-12')
  |   .find('textarea')

Here's the UI UI. Anyone can help me?

Upvotes: 0

Views: 519

Answers (2)

INDIVIDUAL-IT
INDIVIDUAL-IT

Reputation: 446

I would use an Xpath. something like : //div[@class="block-card list-group-item text-card col-xs-12"]//textarea

Upvotes: 1

VysakhMohan
VysakhMohan

Reputation: 567

This might work

let textArea = Selector('.hwt-container').find('textarea').withAttribute('class','text-card-text')

Upvotes: 2

Related Questions