question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The 'flutter:waitFor' command doesn't work with '{durationMilliseconds: 100}' option

See original GitHub issue

First case Using the flutter:waitFor command with {durationMilliseconds: 100} as specified in the appium-flutter-driver Commands returns an error:

 An unknown server-side error occurred while processing the command. Original error: durationMilliseconds is not a valid options.

Command example:

await driver.execute('flutter:waitFor', find.byValueKey('password'), {durationMilliseconds: 100});

Second case If use the flutter:waitFor command with milliseconds as mentioned in one of the ‘Issues’ here, for example:

await driver.execute('flutter:waitFor', find.byValueKey('password'), 5000);

It works, the command waits for 5 seconds (with 3 tries, 15 seconds in total), BUT in case the element is not displayed within the specified time - it also returns an server-side error:

 An unknown server-side error occurred while processing the command. Original error: Cannot execute command waitFor, server reponse {
  "isError": true,
  "response": "Timeout while executing waitFor: TimeoutException after 0:00:05.000000: Future not completed\n",
  "type": "_extensionType",
  "method": "ext.flutter.driver"
}

I’m using WebdriverIO + appium 2.0.0-beta.44 + appium-flutter-driver 1.7.2 + appium-flutter-finder 0.1.0

So what is the correct way to use the flutter:waitFor command? Maybe there is some other alternative?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
KazuCocoacommented, Oct 13, 2022

The error and the behavior itself come from Flutter/Dart VM. Appium flutter driver just sends commands defined in https://api.flutter.dev/flutter/flutter_driver/flutter_driver-library.html to them. Thus, if something behavior seems weird, maybe you need to report it in the Flutter team. (but I guess they won’t maintain the flutter_driver so much.)

1reaction
KazuCocoacommented, Oct 12, 2022

Thank you. I’ve modified the readme

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Error: durationMilliseconds is not a valid options" - flutter ...
ie: The timeout is for 1000 milliseconds (not 1 millisecond). The wait.ts logic does *1000 on the durationMilliseconds parameter; so the ...
Read more >
How can I "sleep" a Dart program - Stack Overflow
import 'dart:io'; sleep(Duration(seconds:1));. Note: This blocks the entire process (isolate), so other async functions will not be processed.
Read more >
WaitUntil flutter Code Example - Code Grepper
1. Future.delayed(Duration(milliseconds: 100), () { ; 2. // Do something ; 3. }); ; 4. ​.
Read more >
Re: How to blocking async future execution until future don't ...
Basically Process.run() is a one shot, run a command and wait for the results. ... Like JavaScript, the language's execution model simply doesn't...
Read more >
How to run code when your app is terminated
If you need to execute code when your app isn't running, there are several options open to you depending on what you're trying...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found