raise LdtpExecutionError(e.faultString.encode('utf-8')) error message

Jul 24, 2013 at 10:12 PM
Hi,

FACTS:

I am using CobraWinLDTP-3.5.0-Win8.msi for a qt application written with qt 4.8.4 version.

Language --> Python

There is a text field in application for username and I am using a command

print activatetext(app, 'txt0') ---> Returns 1
settextvalue(app, 'txt0', 'test') --> Throws following exception



RESULT:

Traceback (most recent call last):
File "C:\Users\apatel\Desktop\MBAM python\gui.py", line 19, in <module>
settextvalue(app, 'txt0', 'test')
File "C:\Program Files (x86)\VMware\CobraWinLDTP\ldtp\client.py", line 66, in
call
return self.__send(self.__name, args)
File "C:\Python27\lib\xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "C:\Program Files (x86)\VMware\CobraWinLDTP\ldtp\client.py", line 185, in
request
raise LdtpExecutionError(e.faultString.encode('utf-8'))
ldtp.client_exception.LdtpExecutionError: Unhandled exception: Member not found.
(Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))


Thanks in advance
Coordinator
Jul 24, 2013 at 11:12 PM
Can you please provide me a sample app to reproduce things from my end ? Thanks
Jul 24, 2013 at 11:29 PM
It is unreleased so I can't provide you at the moment. One more thing I found it this.

>>> dir(gettextvalue)

['call', 'class', 'closure', 'code', 'defaults', '_delattr
_', 'dict', 'doc', 'format', 'get', 'getattribute', 'globa
ls
', 'hash', 'init', 'module', 'name', 'new', 'reduce'
, 'reduce_ex', 'repr', 'setattr', 'sizeof', 'str', 'subcla
sshook
', 'func_closure', 'func_code', 'func_defaults', 'func_dict', 'func_doc'
, 'func_globals', 'func_name']


>>> dir(settextvalue)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\xmlrpclib.py", line 1224, in call
return self.__send(self.__name, args)
File "C:\Python27\lib\xmlrpclib.py", line 1577, in __request
request,
File "C:\Program Files (x86)\VMware\CobraWinLDTP\ldtp\client.py", line 187, in
request
raise e
Fault: <Fault 0: 'unsupported method called: settextvalue.dir'>


It appears something is corrupted for settextvalue. My installation went well without any issue so I am not sure what that could be
Coordinator
Jul 24, 2013 at 11:47 PM
Ignore the exception, since its based on xmlrpc, it doesn't provide additional functionality like help, dir etc. I recommend to use online API reference. Thanks Nagappan
Jul 25, 2013 at 12:42 AM
Cool. I'll keep that in mind. But still I am not sure why I m unable to edit in the text field.
Coordinator
Jul 25, 2013 at 1:41 AM
Can you please share a test program ? send me an email. Thanks
Jul 25, 2013 at 5:33 AM
This example recreates the same problem as I am facing

import sys
from PyQt4 import QtGui
from ldtp import *


class Example(QtGui.QWidget):
def __init__(self):
    super(Example, self).__init__()

    self.initUI()

def initUI(self):

    title = QtGui.QLabel('Title')
    author = QtGui.QLabel('Author')
    review = QtGui.QLabel('Review')

    titleEdit = QtGui.QLineEdit()
    authorEdit = QtGui.QLineEdit()
    reviewEdit = QtGui.QTextEdit()

    grid = QtGui.QGridLayout()
    grid.setSpacing(10)

    grid.addWidget(title, 1, 0)
    grid.addWidget(titleEdit, 1, 1)

    grid.addWidget(author, 2, 0)
    grid.addWidget(authorEdit, 2, 1)

    grid.addWidget(review, 3, 0)
    grid.addWidget(reviewEdit, 3, 1, 5, 1)

    self.setLayout(grid) 

    self.setGeometry(300, 300, 350, 300)
    self.setWindowTitle('Review')    
    self.show()

def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())

if name == 'main':
main()


My Script call is:

from ldtp import *


app = 'Review'
print getobjectlist(app)
settextvalue(app, 'txt2', 'dumbass')


Error:

['ukn0', 'mnuSystem', 'mnuSystem1', 'btnMinimize', 'btnMaximize', 'btnClose', 'l
blTitle', 'txt0', 'lblAuthor', 'txt1', 'lblReview', 'txt2', 'ukn1', 'ukn2', 'ukn
3', 'txt3']
Traceback (most recent call last):
File "C:\Users\APatel\Desktop\mbam2.0\test.py", line 26, in <module>
settextvalue(app, 'txt2', 'dumbass')
File "C:\Program Files (x86)\VMware\CobraWinLDTP\ldtp\client.py", line 66, in
call
return self.__send(self.__name, args)
File "C:\Python27\lib\xmlrpclib.py", line 1578, in __request
verbose=self.__verbose
File "C:\Program Files (x86)\VMware\CobraWinLDTP\ldtp\client.py", line 185, in
request
raise LdtpExecutionError(e.faultString.encode('utf-8'))
ldtp.client_exception.LdtpExecutionError: Unhandled exception: Member not found.
(Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
Jul 25, 2013 at 5:33 AM
Thanks in advance for all help:)
Coordinator
Jul 25, 2013 at 7:15 AM
To my knowledge this is bug with the QT accessibility, can you try with pyqt5 and see still the issue is same ? Let me debug further at work tomorrow. Its late night ! Thanks
Jul 25, 2013 at 5:47 PM
I'll try out with pyqt5 today but my app will only be designed with pyqt4 so it would suck if it is actually a bug from QT accessibility side. Meanwhile, I have found a work around

1) Instead of settextvalue() I can use activatewindw(), mouseleftclick() and enterstring() together to get same result as settextvalue()

2) Sometimes setting a focus on app doesn't work with activatewindow() so I have been using another library called pywinauto with ldtp. First I use pywinauto to set focus and then use mouseleftclick() and enterstring()


Let me know if you think for sure it is QT accessibility bug then I can create one for QT devs.

Meanwhile, I really appreciate all your effort for win ldtp (Cobra) and amazing work for sure.

I tried searching for qt compatible GUI automation tool for long and there is little to no information about ldtp out there. Glad I came across this tool

Thanks,
-Arpita
Coordinator
Jul 25, 2013 at 8:44 PM
activatewindow doesn't work, I tried it before responding to you. Try with Visual UI Verify (Microsoft accessibility tool), I get the same exception as you mentioned above. Thanks
Coordinator
Aug 6, 2013 at 12:00 AM
To bring focus of window, other option is, you can:

click('pane0', 'btnWindowTitle') # Here Windows Title will be, what ever you see in task bar. Note: You need to use a different method, if you try to operate on a window with same name, but multiple instance are currently running. Instead of button, it becomes menu. Thanks