2gis / Winium.Cruciatus

C# Framework for automated testing of Windows application based on WinFroms and WPF platforms.
Mozilla Public License 2.0
137 stars 66 forks source link

Clicking on a button that closes the window may trigger an exception #76

Open acolomitchi opened 6 years ago

acolomitchi commented 6 years ago

Repro using the standard "FileOpenDialog":

  1. set the content of the address toolbar and filename combos to point to an existing file
  2. trigger a click on the "Open" button

Chances are the dialog closes fast enough for the Logger.Info(..._ calls in TryClick... methods in CruciatusCommands.cs to find a now-invalid Element, which will cause an exception while trying to format the message. In my case, it happened more often than not.

Suggestion: format the message in advance into a local variable before performing the click action, use the formatted message with Logger.Info after performing the click action.