You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it's pointed out in this SO answer. There is a difference between __repr__ and __str__. The first is more for a developer while the latter is for the user. In the meantime, I implemented __str__ for wrapper-classes that produces the following output for a wrapper with a title: u'uiawrapper.UIAWrapper - "[No Name] - GVIM"'
while for a wrapper without a text it just appends an object ID: u'uiawrapper.UIAWrapper - "" <object 0x4fd98d0>'
Should we produce the same output for __repr__ calls or it might have more technical details ?
In our case both strings are for test developers. We may print the same things for both.
So if __repr__ tends to be unambiguous, we need a unique control identifier to be printed if no text provided. For Win32 it's a handle, for UIA it's a RuntimeID property that I use in __hash__ method.
Also I think in case of no text we may print auto_id value in the following format:
And only if there are no both text values we may output handle or runtime_id.
I may be wrong about "str is for developers too". Alternative way is making str(wrp) an alias for wrp.window_text() but I don't like this idea for now. It would be nice to hear customers opinions about that.
Current output looks quite useless with unnecessary object address.
This could be improved so:
Similar improvement could be done for a window specification object.
Thanks J. Does for the report.
The text was updated successfully, but these errors were encountered: