Re: Python AttributeError: 'Nonetype@ object has no attribute 'SetFocus'
As per documentation:
If the object is searched by XPath and is found, TestComplete tries to match the found object to the one from its objects tree. If the match succeeds, then TestComplete returns its wrapping object that contains all properties and methods added by TestComplete (SetFocus(), .Keys(), etc.).
If the match fails, than native DOM object is returned. In this case test code can use only native properties/methods provided by DOM for this given object within given web browser.
If search by XPath fails then (as described in the XPath documentation) null is returned.
The above is one from a number of reasons why XPath is highly not recommended practice in TestComplete's world.
So, the reason of your problem is simple: XPath failed to find the sought for object.
Recommended correction that works in most of cases: replace .FindChildByXPath() with .FindChildEx() and provide long enough timeout value to guarantee that the sought for control is rendered on the screen.
Regards, /Alex [Community Hero] ____ [Community Heroes] are not employed by SmartBear Software but are just volunteers who have some experience with the tools by SmartBear Software and a desire to help others. Posts made by [Community Heroes] may differ from the official policies of SmartBear Software and should be treated as the own private opinion of their authors and under no circumstances as an official answer from SmartBear Software. The [Community Hero] signature is used with permission by SmartBear Software. https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame ================================