我需要找到的元素位于(在子元素中):
static Widget _buildProjectCategoryWidget(BuildContext context, String name) {
final themeData = Theme.of(context);
final primaryTextTheme = themeData.primaryTextTheme;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 5.0),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(13.0), color: FlAppStyles.altButtonColor),
child: Text(name, style: primaryTextTheme.textSmall),
);
我试图用这个找到子元素,但我有 DriverError: Failed to fulfill Tap due to remote error:
SerializableFinder message = find.text("mytext");
await driver.waitFor(message);
expect(await driver.getText(message), "mytext"); await driver.tap(buttonChangeProfession);
我是flutter集成测试的初学者,不知道出了什么问题,请帮忙。我还尝试添加一个键并通过它查找元素,但关键是我需要找到该元素的文本。