我正在尝试使用适用于Python的LDTP v3.5.0在Fedora上测试我的Gtk + -2.0应用程序。
在应用程序的UI上,某些组合框控件的下拉列表将根据其他控件的值通过代码进行更改。
LDTP可以正常工作,直到组合框下拉列表更改为止。
为使问题更简单,我编写了以下简单应用程序。
#include <gtk/gtk.h>
GtkWidget* combobox;
GtkWidget* button1;
GtkWidget* button2;
int optCount = 0;
void on_clicked(GtkButton* button, gpointer user_data)
{
while (optCount > 0) {
gtk_combo_box_text_remove((GtkComboBoxText*)combobox, 0);
optCount--;
}
if (button == (GtkButton*)button1) {
gtk_combo_box_append_text((GtkComboBox*)combobox, "Option 1");
gtk_combo_box_append_text((GtkComboBox*)combobox, "Option 2");
optCount = 2;
}
else if (button == (GtkButton*)button2) {
gtk_combo_box_append_text((GtkComboBox*)combobox, "Option 1");
gtk_combo_box_append_text((GtkComboBox*)combobox, "Option 2");
gtk_combo_box_append_text((GtkComboBox*)combobox, "Option 3");
optCount = 3;
}
if (optCount > 0) {
gtk_combo_box_set_active((GtkComboBox*)combobox, 0);
}
}
int main(int argc, char* argv[])
{
GtkWidget* window;
GtkWidget* vbox;
GtkWidget* label;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title((GtkWindow*)window, "test");
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
vbox = gtk_vbox_new(TRUE, 1);
gtk_container_add((GtkContainer*)window, vbox);
label = gtk_label_new("Options:");
gtk_container_add((GtkContainer*)vbox, label);
combobox = gtk_combo_box_text_new();
gtk_container_add((GtkContainer*)vbox, combobox);
button1 = gtk_button_new_with_label("Button 1");
g_signal_connect(button1, "clicked", G_CALLBACK(on_clicked), NULL);
gtk_container_add((GtkContainer*)vbox, button1);
button2 = gtk_button_new_with_label("Button 2");
g_signal_connect(button2, "clicked", G_CALLBACK(on_clicked), NULL);
gtk_container_add((GtkContainer*)vbox, button2);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
单击两个按钮后,组合框的下拉列表将更改。
然后在python控制台中进行以下测试:
>>> launchapp('/home/devel/test')
70620
>>> GTK Accessibility Module initialized
>>> click('test', 'Button 1')
1
>>> getallitem('test', 'cbo*')
[]
>>> showlist('test', 'cbo*')
1
>>> hidelist('test', 'cbo*')
1
>>> getallitem('test', 'cbo*')
['Option 1', 'Option 2']
>>> click('test', 'Button 2')
1
>>> getallitem('test', 'cbo*')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 75, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/site-packages/ldtp/client.py", line 200, in request
raise e
xmlrpclib.Fault: <Fault 8002: 'atspi_error: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" could not be processed as object /org/a11y/atspi/accessible/9 does not exist\n (1)'>
>>>
LDTP的日志:
launchapp('/home/devel/test', [], 0, 1, 'C')
GTK Accessibility Module initialized
click('test', 'Button 1')
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11810480)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af1e0 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a8afa0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af1e0 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e117fa220)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e117fa220)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11808d10)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e118359c0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11819250)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11842de0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11842de0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1184ccc0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1184ccc0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e118e20d0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e118e20d0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e118e20d0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11906750)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11974340)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11974340)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1197b000)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1197b000)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1197b000)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1197b000)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1197b000)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e1197b000)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11819ce0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3ba0)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11819ce0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a08eb0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a08eb0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a08eb0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a08eb0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a08eb0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e11a913d0)>, <Atspi.Accessible object at 0x7f85200ed050 (AtspiAccessible at 0x563e1117e250)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e11a08eb0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af320 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
click
getallitem('test', 'cbo*')
(<Atspi.Event object at 0x7f85201e3f58 (AtspiEvent at 0x563e11a5b200)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af730 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3f58 (AtspiEvent at 0x563e1190ead0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af820 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
showlist('test', 'cbo*')
press
hidelist('test', 'cbo*')
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e117f31e0)>, 'window:create', <Atspi.Accessible object at 0x7f85200af960 (AtspiAccessible at 0x563e1188a920)>, <Atspi.Accessible object at 0x7f85200af820 (AtspiAccessible at 0x563e11a83da0)>)
(<Atspi.Event object at 0x7f85201e3ce8 (AtspiEvent at 0x563e117f31e0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200af960 (AtspiAccessible at 0x563e1188a920)>, <Atspi.Accessible object at 0x7f85200af820 (AtspiAccessible at 0x563e11a83da0)>)
press
getallitem('test', 'cbo*')
(<Atspi.Event object at 0x7f85201e3f58 (AtspiEvent at 0x563e11906d60)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200af9b0 (AtspiAccessible at 0x563e1188a920)>, <Atspi.Accessible object at 0x7f85200af780 (AtspiAccessible at 0x563e11a83da0)>)
(<Atspi.Event object at 0x7f85201e3f58 (AtspiEvent at 0x563e119497c0)>, 'window:destroy', <Atspi.Accessible object at 0x7f85200af820 (AtspiAccessible at 0x563e1188a920)>, <Atspi.Accessible object at 0x7f85200af780 (AtspiAccessible at 0x563e11a83da0)>)
click('test', 'Button 2')
click
getallitem('test', 'cbo*')
(<Atspi.Event object at 0x7f85201e3f58 (AtspiEvent at 0x563e117f31e0)>, 'window:deactivate', <Atspi.Accessible object at 0x7f85200afb90 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
(<Atspi.Event object at 0x7f85201e3f58 (AtspiEvent at 0x563e117f31e0)>, 'window:activate', <Atspi.Accessible object at 0x7f85200afb90 (AtspiAccessible at 0x563e117f3c20)>, <Atspi.Accessible object at 0x7f85200ed500 (AtspiAccessible at 0x563e10e73a50)>)
Unhandled Error
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/twisted/web/server.py", line 190, in process
self.render(resrc)
File "/usr/lib64/python2.7/site-packages/twisted/web/server.py", line 241, in render
body = resrc.render(self)
File "/usr/lib64/python2.7/site-packages/twisted/web/resource.py", line 250, in render
return m(request)
File "/usr/lib/python2.7/site-packages/ldtpd/xmlrpc_daemon.py", line 126, in render_POST
**kwargs).\
--- <exception caught here> ---
File "/usr/lib64/python2.7/site-packages/twisted/internet/defer.py", line 149, in maybeDeferred
result = f(*args, **kw)
File "/usr/lib/python2.7/site-packages/ldtpd/combo_box.py", line 428, in getallitem
obj = self._get_object(window_name, object_name)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 961, in _get_object
obj_name, obj_type)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 971, in _internal_get_object
appmap = self._appmap_pairs(window_handle, window_name)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 779, in _appmap_pairs
self._populate_appmap(gui, _parent, gui.getIndexInParent())
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 746, in _populate_appmap
self._populate_appmap(child, parent, index)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 746, in _populate_appmap
self._populate_appmap(child, parent, index)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 746, in _populate_appmap
self._populate_appmap(child, parent, index)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 746, in _populate_appmap
self._populate_appmap(child, parent, index)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 732, in _populate_appmap
parent = self._add_appmap_data(obj, parent, child_index)
File "/usr/lib/python2.7/site-packages/ldtpd/utils.py", line 697, in _add_appmap_data
for j in xrange(iaction.nActions):
File "/usr/lib/python2.7/site-packages/pyatspi/action.py", line 106, in get_nActions
return Atspi.Action.get_n_actions(self.obj)
GLib.Error: atspi_error: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" could not be processed as object /org/a11y/atspi/accessible/9 does not exist
(1)
有人可以帮忙找出原因吗?我的测试应用程序或python测试代码出了什么问题?