System.ArgumentNullException in UIAutomationClient

Multi tool use


System.ArgumentNullException in UIAutomationClient
I received the following error:
An unhandled exception of type 'System.ArgumentNullException' occurred in UIAutomationClient.dll
Additional information: Value cannot be null.
it appears at textImage. Here is my code
// localize "Versicherungsnehmer"
AutomationElement textVN = windowCOB.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Versicherungsnehmer "));
// jump to next item (no text, just an image named "")
AutomationElement textImage = TreeWalker.ControlViewWalker.GetNextSibling(textVN);
// jump to next item "textAnsprache" which has a Name in inspect)
AutomationElement textAnsprache = TreeWalker.ControlViewWalker.GetNextSibling(textImage);
// read Value "Ansprache" from Inspect
string vnAnsprache = textAnsprache.Current.Name;
I assume the error is due to the fact that textImage is not a actual text/word but instead is an image. how can solve this error?
your help is much appreciated
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.