salat
salat

Reputation: 3

How to get text array using flutter driver

I have several elements with the same key. How to get text from this elements and store it to array? I didn't find any methods in flutter driver doc. If I use driver.getText(), then I receive error 'Too many elements'.

P.S I know that is possible in integration_test widget tests but I can use only Flutter driver

I've tried diver.getText(), looked into doc.

@override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        Text(
          title,
          style: context.textTheme.displayMedium?.apply(
            color: context.theme.indicatorColor,
          ),
          key: Key('test'),
          overflow: TextOverflow.ellipsis,
        ),
        SizedBox(
          height: context.responsiveSize(4),
        ),
        Text(
          size ?? date,
          style: context.textTheme.displayMedium,
          overflow: TextOverflow.ellipsis,
        ),
      ],
    );
  }
}

I have 4 elements with key 'test'

In my tests I'm trying to get text from these elements using

await driver.getText(find.byValueKey('test'));

and I have 'Too many elements' error

Upvotes: 0

Views: 47

Answers (0)

Related Questions