How to find Close Button with flutter drive

Issue

I am testing a flutter Cupertino styled app using flutter drive.

I have trouble closing a full-screen page because I cannot find the close button.

What would be the correct find.by??? instruction to be able to tap the close button in a
Cupertino styled app?

Solution

You can use find.pageBack() like in await driver.tap(find.pageBack()); to find the button that has the page back functionality, either a back arrow or a close cross, if present in the AppBar.

Alternatively you can use directly find.byTooltip('Back') or find.byTooltip('Close') to find back arrows or close buttons.

Answered By – Miguel Beltran

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *