jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

MsUia: Error Clicking Control #67

Closed leviwilson closed 11 years ago

leviwilson commented 11 years ago

When clicking on a control using the :ms_uia adapter, sometimes the following exception is thrown:

RuntimeError: System.Runtime.InteropServices.COMException (0x80042002): Exception from HRESULT: 0x80042002
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at MS.Internal.Automation.UiaCoreApi.CheckError(Int32 hr)
   at AutomationClicker.Click()
   at RA_Click(_FindInformation* findInformation, SByte* errorInfo, Int32 errorInfoSize)

The control exists and it seems like everything should click through properly.

leviwilson commented 11 years ago

According to this post, retrying the click works. Modified the :RA_Click method to return whether or not it was successful so Control#click would continue to try. This fixed the issue in my app, but I was unable to reproduce it in the test application.