Giter Club home page Giter Club logo

ldtp2's Introduction

LDTP

https://travis-ci.org/ldtp/ldtp2.svg?branch=master

LDTP is the best cross platform GUI testing tool out there. Why? Because it works on Linux, Windows, OS X, Solaris, FreeBSD, NetBSD, and Palm Source. Your feedback is much appreciated, please send an email to Nagappan.

LDTP runs on

Requirements

DE Requirements

  • GNOME Version - min 2.24
  • Accessibility enabled

Dependencies

  • pyatspi (python-atspi)
  • python-twisted-web
  • python-wnck
  • python-gnome

Optional Dependencies

Build LDTP on Linux

First checkout ldtp from github and cd into ldtp2.

$ git clone https://github.com/ldtp/ldtp2.git

$ cd ldtp2/

Then build and install.

$ python setup.py build

$ sudo python setup.py install

Note: If your GNOME version is less than or equal to 2.24, then use LDTPv1 (1.7.x)

Writing tests

It is best to read the documentation, so first cd into the doc directory.

$ cd ldtp2/doc/

Then you can either read ldtp-tutorial.rst in you favorite text editor or build a pdf. First install rst2pdf, then run:

$ rst2pdf ldtp-tutorial.rst

Then open the pdf in your favorite pdf viewer.

You can also refer to the following for more information:

Writing LDTP test scripts in Python scripting language LDTP API Reference page

Contact LDTP

We are in #ldtp on irc.freenode.net and are also available on the LDTP mailing list

Contributing

So you want to help? Fantastic! If you are looking for ideas on what to work on ask on the mailing list or ping us in irc, we love meeting new people.

Generally the process is fork https://github.com/ldtp/ldtp2, make your changes, and make a pull request.

ldtp2's People

Contributors

agentydragon avatar colinligertwood avatar elharo avatar huxiang avatar jstavel avatar majorsilence avatar nagappan avatar nfelt14 avatar paetzke avatar schuellerf avatar sganesh avatar shravanrajrk avatar strepon avatar stuaxo avatar sturmf avatar tylerhotan avatar waldyrious avatar xsawyerx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ldtp2's Issues

ldtp action 'click' does nothing on an element 'table cell header'

Hello,
am trying to click on a 'table cell header' in the application 'subscription-manager-gui'.

snimek z 2016-10-12 13-39-32

This code in ldtp does not work:

selecttab("frmSubscriptionManager","ptl0", 'ptabAllAvailableSubscriptions')
click("frmSubscriptionManager","tchSubscription")

I have tried to perfom this action by dogtail library:

#!/usr/bin/python
from dogtail import tree
submangui = [app for app in tree.root.applications()
                      if 'subscription-manager-gui' == app.name and app.children][0]
print submangui.child("All Subscriptions View", roleName="tree table")
   .child("Subscription", roleName="table column header")
   .doActionNamed('click')

I was trying to compare those codes. Both use an object of the same type at the end - atspi.Action.

I cannot find out differrences between ldtp code and dogtail code.
Maybe some configuration of AT-SPI layer. Or something else.

Install error: ImportError: No module named ldtp

As can be seen from a Travis CI build log, importing ldtp fails:

python minimal.py

gives:

Traceback (most recent call last):
  File "minimal.py", line 3, in <module>
    from ldtp import *
ImportError: No module named ldtp

First line in minimal.py is from ldtp import * (it is a script suggested by @nagappan at #35).

This is the compete reproduction of it (from the .travis.yml script):

# Install prerequisites
sudo apt-get install python-twisted-web
sudo apt-get install python-wnck
# Build LDTP
python setup.py build
sudo python setup.py install
# Build and run examples
cd examples
python minimal.py

It guess someone with some Python knowledge can easily see what went wrong.

TypeError: Cannot create a consistent method resolution order (MRO) for bases Utils, LayeredPane

Hi!
I am trying to use your project for Almalinux 9 OS. The installation and preparation of the environment are performed according to your documentation. When trying to run a test script gedit.py an error appears:

[user@msvsphere-9 ldtp2]$ /usr/bin/env /bin/python /home/user/.vscode/extensions/ms-python.python-2023.22.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 59373 -- /home/user/ldtp2/examples/gedit.py
Traceback (most recent call last):
File "", line 1, in
File "/home/user/ldtp2/ldtpd/init.py", line 38, in
from .xmlrpc_daemon import XMLRPCLdtpd
File "/home/user/ldtp2/ldtpd/xmlrpc_daemon.py", line 25, in
from . import core
File "/home/user/ldtp2/ldtpd/core.py", line 68, in
from .combo_box import ComboBox
File "/home/user/ldtp2/ldtpd/combo_box.py", line 286, in
class ComboBox(Utils, LayeredPane):
TypeError: Cannot create a consistent method resolution
order (MRO) for bases Utils, LayeredPane
Traceback (most recent call last):
File "/home/user/ldtp2/examples/gedit.py", line 20, in
import ldtp, ooldtp
File "/usr/local/lib/python3.9/site-packages/ldtp-3.5.1-py3.9.egg/ldtp/init.py", line 593, in
_populateNamespace(globals())
File "/usr/local/lib/python3.9/site-packages/ldtp-3.5.1-py3.9.egg/ldtp/init.py", line 247, in _populateNamespace
for method in client._client.system.listMethods():
File "/usr/lib64/python3.9/xmlrpc/client.py", line 1122, in call
return self.__send(self.__name, args)
File "/usr/lib64/python3.9/xmlrpc/client.py", line 1464, in __request
response = self.__transport.request(
File "/usr/local/lib/python3.9/site-packages/ldtp-3.5.1-py3.9.egg/ldtp/client.py", line 152, in request
h=self.send_request(host, handler, request_body, bool(verbose))
File "/usr/lib64/python3.9/xmlrpc/client.py", line 1291, in send_request
self.send_content(connection, request_body)
File "/usr/lib64/python3.9/xmlrpc/client.py", line 1321, in send_content
connection.endheaders(request_body)
File "/usr/lib64/python3.9/http/client.py", line 1280, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib64/python3.9/http/client.py", line 1040, in _send_output
self.send(msg)
File "/usr/lib64/python3.9/http/client.py", line 980, in send
self.connect()
File "/usr/lib64/python3.9/http/client.py", line 946, in connect
self.sock = self._create_connection(
File "/usr/lib64/python3.9/socket.py", line 844, in create_connection
raise err
File "/usr/lib64/python3.9/socket.py", line 832, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Please help me figure out this error.

How is ldtp2 itself tested?

I wondered how ldtp2 itself is tested.

In case this is not done, or is done using manual scripts, then I volunteer to add automatic testing performed by Travis CI (free for FLOSS development).

LDTP linux cross-compiler build steps

Hi All,

I need to build ldtp using a specific cross compiler so it can run on my linux build.
Has anyone had any luck with this? Any pointers on how to go about this task would be highly appreciated.

Thanks a lot in advance.

Test examples/gcalctool.py fails, both locally and on Travis CI

When I run python gcalctool.py the tests fail:

richel@lubuntu:~/GitHubs/ldtp2/examples$ python gcalctool.py 
/usr/local/lib/python2.7/dist-packages/ldtpd/core.py:29: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Wnck as wnck
/usr/lib/python2.7/dist-packages/pyatspi/Accessibility.py:41: Warning: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
  len=self.get_child_count()
EE
======================================================================
ERROR: testInteraction (__main__.WidgetTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gcalctool.py", line 30, in setUp
    self.tearDown()
  File "gcalctool.py", line 34, in tearDown
    ldtp.selectmenuitem('frmCalculator*', 'mnuQuit')
  File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 75, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 198, in request
    raise LdtpExecutionError(e.faultString.encode('utf-8'))
LdtpExecutionError: Unable to find window "frmCalculator*"

======================================================================
ERROR: testViews (__main__.WidgetTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gcalctool.py", line 30, in setUp
    self.tearDown()
  File "gcalctool.py", line 34, in tearDown
    ldtp.selectmenuitem('frmCalculator*', 'mnuQuit')
  File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 75, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 198, in request
    raise LdtpExecutionError(e.faultString.encode('utf-8'))
LdtpExecutionError: Unable to find window "frmCalculator*"

----------------------------------------------------------------------
Ran 2 tests in 63.664s

When I did sudo apt-get install gcalctool, I got the hint to install gnome-calculator.

May it be that all that needs to be changed is that instead of gcalctool, gnome-calculator is called in the gcalctool.py script?

I will

  • Check as such
  • Reproduce on Travis

LdtpExecutionError on gettextvalue() from label

I'm running simple test script which is trying to pull the text from a label which contains a version number of the application. This was a QLabel object in QT4.8, listed as a "label" object in the Application Map. I've tried getproperty(window,obj,'label') but this just returns the QT object name. gettextvalue() throws an Exception. I've pasted the list of object properties and the Exception below.

Background:
Debian 7.8 running on a Pi
QT4.8 application running in python 3.2
Test scripts running in python 2.7.3 with module LDTP 3.5.0

Object properties

lbllabelVersion
child_index: 1
label: labelVersion
parent: pnlpageConfiggroupAbout
key: lbllabelVersion
obj_index: lbl#26
class: label

Exception

Traceback (most recent call last):
  File "test.py", line 70, in checkconfigpage
    print("text:" + gettextvalue(self.WINDOW_NAME, obj))
  File "/usr/local/lib/python2.7/dist-packages/ldtp/__init__.py", line 407, in gettextvalue
    return unicode(_remote_gettextvalue(window_name, object_name, startPosition, endPosition))
  File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 69, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1591, in __request
    verbose=self.__verbose
  File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 189, in request
    raise LdtpExecutionError(e.faultString.encode('utf-8'))
LdtpExecutionError: Text cannot be retrieved from object [label | labelVersion].

I've tried a few work arounds with no success and find little on google to solve this. Thanks.

Status of project and repository unclear

This githup repo looks fresh (last commit in february) - OK.

But in your README.md you mention the website https://ldtp.freedesktop.org/ and the mailinglist http://lists.freedesktop.org/mailman/listinfo/ldtp-dev

The website is old (last update 2016-03-11) and full of dead and bad links.
The mailinglist looks dead also - last entry from Oct 2018.

So what is about the official LDTP project?
What is the status? Who is responsibel for it?

What is about this repo? Is it the official repo or just a contributers clone repo?

Please make the answers clear in your README.md. If you are official LDTP then state it there.

If so I will open several Issues regarding the problems on your website.

Python 3

Python 2 is going away next year, are there plans to move to Python 3?

Typeerror: Cannot Create A Consistent Method Resolution Order (Mro) when trying to launch ldtp daemon via "#ldtp -s"

trying to launch ldtp daemon via "ldtp -s" and get below error message

Traceback (most recent call last):
File "/usr/local/bin/ldtp", line 4, in
import('pkg_resources').run_script('ldtp==3.5.1', 'ldtp')
File "/usr/lib/python3.11/site-packages/pkg_resources/init.py", line 722, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python3.11/site-packages/pkg_resources/init.py", line 1561, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.11/site-packages/ldtp-3.5.1-py3.11.egg/EGG-INFO/scripts/ldtp", line 23, in
import ldtpd
File "/usr/local/lib/python3.11/site-packages/ldtp-3.5.1-py3.11.egg/ldtpd/init.py", line 40, in
from xmlrpc_daemon import XMLRPCLdtpd
File "/usr/local/lib/python3.11/site-packages/ldtp-3.5.1-py3.11.egg/ldtpd/xmlrpc_daemon.py", line 25, in
import core
File "/usr/local/lib/python3.11/site-packages/ldtp-3.5.1-py3.11.egg/ldtpd/core.py", line 65, in
from combo_box import ComboBox
File "/usr/local/lib/python3.11/site-packages/ldtp-3.5.1-py3.11.egg/ldtpd/combo_box.py", line 286, in
class ComboBox(Utils, LayeredPane):
TypeError: Cannot create a consistent method resolution
order (MRO) for bases Utils, LayeredPane

which can be fixed by switching the order of base classes:
class ComboBox(Utils, LayeredPane):
to
class ComboBox(LayeredPane,Utils):

looks like a diamond Inheritance problem.

pip install ldtp fails because there is no setup.py

$ pip install -v ldtp
Created temporary directory: /tmp/pip-ephem-wheel-cache-r4DZTy
Created temporary directory: /tmp/pip-install-coye19
Collecting ldtp
  1 location(s) to search for versions of ldtp:
  * https://pypi.org/simple/ldtp/
  Getting page https://pypi.org/simple/ldtp/
  Looking up "https://pypi.org/simple/ldtp/" in the cache
  Current age based on date: 398
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  The response is "fresh", returning cached response
  600 > 398
  Analyzing links from page https://pypi.org/simple/ldtp/
    Found link https://files.pythonhosted.org/packages/5e/fd/e362c5ea06c62b0f056d60afd6256ee65f1e9882ddac19b8995c49e7d237/ldtp-1.0.0.tar.gz#sha256=80a60d8778caf619983e3046bbd4135cfb879f2f21f38c7acef1138eb98ad4a2 (from https://pypi.org/simple/ldtp/), version: 1.0.0
  Using version 1.0.0 (newest of versions: 1.0.0)
  Created temporary directory: /tmp/pip-unpack-ZrM7hn
  Looking up "https://files.pythonhosted.org/packages/5e/fd/e362c5ea06c62b0f056d60afd6256ee65f1e9882ddac19b8995c49e7d237/ldtp-1.0.0.tar.gz" in the cache
  Ignoring unknown cache-control directive: 
  Current age based on date: 398
  Ignoring unknown cache-control directive: immutable
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 398
  Using cached https://files.pythonhosted.org/packages/5e/fd/e362c5ea06c62b0f056d60afd6256ee65f1e9882ddac19b8995c49e7d237/ldtp-1.0.0.tar.gz
  Downloading from URL https://files.pythonhosted.org/packages/5e/fd/e362c5ea06c62b0f056d60afd6256ee65f1e9882ddac19b8995c49e7d237/ldtp-1.0.0.tar.gz#sha256=80a60d8778caf619983e3046bbd4135cfb879f2f21f38c7acef1138eb98ad4a2 (from https://pypi.org/simple/ldtp/)
  Running setup.py (path:/tmp/pip-install-coye19/ldtp/setup.py) egg_info for package ldtp
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/tmp/pip-install-coye19/ldtp/setup.py'
Cleaning up...
  Removing source in /tmp/pip-install-coye19/ldtp
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-coye19/ldtp/
Exception information:
Traceback (most recent call last):
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 324, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/operations/prepare.py", line 154, in prep_for_dist
    self.req.run_egg_info()
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/req/req_install.py", line 486, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/home/stu/.local/lib/python2.7/site-packages/pip/_internal/utils/misc.py", line 698, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-coye19/ldtp/
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

atspi_error: Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties" could not be processed as object /org/a11y/atspi/accessible/775 does not exist\n (1)'>

i am developing a UI automation script using LDTP(python3) , the Application is a Eclipse base IDE which has a multiple applications which on selection various build ui objects name will be updated according to application selected such as "XXXXBuild" on selection of XXXX application, i am observing above error on switching between applications
issue_log.txt

LDTP2 engine is crashing and ldtp client is reporting connection refused 111 error

Hi,

We're running LDTP in a python script in ubuntu 16.04
These scripts are invoked from RobotFramework to find active prompts on Ubuntu machine.

We're running ldtp script using python subprocess module.
But we're getting following exception when we run above.
` from ldtp import *
File "/usr/local/lib/python2.7/dist-packages/ldtp/init.py", line 593, in
_populateNamespace(globals())
File "/usr/local/lib/python2.7/dist-packages/ldtp/init.py", line 255, in _populateNamespace
d[local_name].doc = client._client.system.methodHelp(method)
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in call
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 154, in request
response.reason, response.msg.headers)
xmlrpclib.ProtocolError: <ProtocolError for localhost:4118/RPC2: 500 Internal Server Error>
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 1408, in dataReceived
finishCallback(data[contentLength:])
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 1673, in _finishRequestBody
self.allContentReceived()
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 1736, in allContentReceived
req.requestReceived(command, path, version)
File "/usr/local/lib/python2.7/dist-packages/twisted/web/http.py", line 762, in requestReceived
self.process()
--- ---
File "/usr/local/lib/python2.7/dist-packages/twisted/web/server.py", line 183, in process
self.render(resrc)
File "/usr/local/lib/python2.7/dist-packages/twisted/web/server.py", line 234, in render
body = resrc.render(self)
File "/usr/local/lib/python2.7/dist-packages/twisted/web/resource.py", line 250, in render
return m(request)
File "/usr/local/lib/python2.7/dist-packages/ldtpd/xmlrpc_daemon.py", line 120, in render_POST
print(debug_st)
exceptions.IOError: [Errno 32] Broken pipe

Traceback (most recent call last):
File "/opt/automation/DGAutomation/Libraries/PromptHandler/PFLinux.py", line 2, in
from ldtp import *
File "/usr/local/lib/python2.7/dist-packages/ldtp/init.py", line 593, in
_populateNamespace(globals())
File "/usr/local/lib/python2.7/dist-packages/ldtp/init.py", line 255, in _populateNamespace
d[local_name].doc = client._client.system.methodHelp(method)
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in call
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/local/lib/python2.7/dist-packages/ldtp/client.py", line 154, in request
response.reason, response.msg.headers)
xmlrpclib.ProtocolError: <ProtocolError for localhost:4118/RPC2: 500 Internal Server Error> `

This is not observed when run from ldtp import * in python interactive prompt.
We're using selenium to open Firefox browser, browser is getting opened.

General Q: Getting text from Windows

Hi, what would be a common method to obtain text from a window? Maybe iteratively obtain text from all sections of a browser, or just the main viewport? Is this possible?

Would it also be possible to highlight portions of the text to draw attention to it?

Thanks

ImportError: No module named 'xmlrpc_daemon'

Hello,

I am trying to install LDTP on Ubuntu 16.04.04 LTS (inside a Docker container).

The following packages were installed:

apt-get install git python3-pip python3-twisted python3-gi python3-gi-cairo gir1.2-gtk-3.0 python3-pyatspi -y

And then I try to install LDTP with the following commands:

mkdir -p /tmp/ldtp
cd /tmp/ldtp
git clone https://github.com/ldtp/ldtp2.git
cd ldtp2
python3 setup.py build
python3 setup.py install

After executing ldtp on the CLI the following error appears and ldtp terminates:

Traceback (most recent call last):
  File "/usr/local/bin/ldtp", line 23, in <module>
    import ldtpd
  File "/usr/local/lib/python3.5/dist-packages/ldtpd/__init__.py", line 38, in <module>
    from xmlrpc_daemon import XMLRPCLdtpd
ImportError: No module named 'xmlrpc_daemon'

I have no experience developing with python but in my understanding, the module xmlrpc_daemon cannot be imported, which is is defined in the LDTP project itself.

Maybe someone in here knows how to fix this? I appreciate any help!

Doubleclickrow just click once

I am trying to use this function to send a double click in a tree row and it just click once, also the documentation of this function say that this method just click once:

>ldtp.doubleclickrow.__doc__
Single click row matching given text

    @param window_name: Window name to type in, either full name,
    LDTP's name convention, or a Unix glob.
    @type window_name: string
    @param object_name: Object name to type in, either full name,
    LDTP's name convention, or a Unix glob. 
    @type object_name: string
    @param row_text: Row text to select
    @type row_text: string

    @return: row index matching the text on success.
    @rtype: integer

(ldtp:3781): WARNING **: AT-SPI: Error in GetItems,

Hi . I install ldtp by git clone and followed the step on your site (make install ..etc) using Fedora24
And when I try to import ldtp in python IDE, it gave me a bad news:

`/usr/lib/python2.7/site-packages/ldtpd/init.py:45: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import Gtk
/usr/lib/python2.7/site-packages/ldtpd/core.py:29: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import Wnck as wnck
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95bab230)>, 'window:deactivate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95ba48c0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)

** (ldtp:3884): WARNING **: AT-SPI: Error in GetItems, sender=(null), error=Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95be94d0)>, 'window:activate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95ba48c0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95bd9ea0)>, 'window:create', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95bde6a0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95be8740)>, 'window:deactivate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95ba48c0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95be8740)>, 'window:activate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95bde6a0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95c019f0)>, 'window:deactivate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95bde6a0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95c019f0)>, 'window:activate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95bde6a0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95c019f0)>, 'window:deactivate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95bde6a0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
(<Atspi.Event object at 0x7fc73d172e88 (AtspiEvent at 0x55db95c019f0)>, 'window:activate', <Atspi.Accessible object at 0x7fc73d191a00 (AtspiAccessible at 0x55db95ba48c0)>, <Atspi.Accessible object at 0x7fc73d191550 (AtspiAccessible at 0x55db957fb0a0)>)
`
I am , in fact , really confused about that. Would anyone please give me some advice?

ooldtp has no attribute 'context'

When I run ~/Documents/ldtp2/examples$ python gedit.py I get this error:

Traceback: (most recent call last):
  File "gedit.py", line 24, in <module>
    frm = ooldtp.context.('*gedit')
AttributeError: 'module' object as no attribute 'context'

I am on Ubuntu 16.05.3 LTS (Xenial)

I am able to start the python interpreter and enter >>>from ldtp import * When I do this, I get no errors, and I can enter >>>getwindowlist() successfully, and get proper results. As far as I can tell, ldtp and its dependencies are installed correctly.
When I import ldtp, I get PyGIWarnings, saying that Gtk, Atspi, and Wnck were imported without specifying a version first, and that I should use gi.require_version() before imports. Gtk and Wnck are imported in ldtpd, and Atspi is imported in pyatspi.
Would this be the reason there is no context attribute in ooldtp, and if not, why am I getting this error?

Issues on Dependencies

Dependencies
pyatspi (python-atspi)
python-twisted-web
python-wnck
python-gnome

I am still struggling with istallation of pyatspi on RHEL.
Debian.org seems to maintain pyatspi but RedHat.com doesn't have anything on pyatspi.

Has anyone succeeded installation of all of 4 dependencies above on RHEL, especially pyatspi?

Thank you!

socket.error [Erroro 111]

Hi,
The basic question i have is how exactly to use this ldtp. When i was reading the document i found out there is something called as ldtp client and ldtp server. can you please explain on these.
I have another doubt of why is this socket error coming up. Means what exactly it is doing? is it trying to connect to some other ip?
There is a socket error while I trying to import ldtp.
The error message has followed:

screenshot

I am using SLE 11 SP3(Opensuse) version. Request you to respond as early as possible.
Many thanks in Advance!!

sudo python setup.py install returns an error

Installing ldtp script to /usr/bin

Installed /usr/lib/python2.7/site-packages/ldtp-3.5.1-py2.7.egg
Processing dependencies for ldtp==3.5.1
Searching for twisted
Reading https://pypi.python.org/simple/twisted/
Couldn't find index page for 'twisted' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for twisted
error: Could not find suitable distribution for Requirement.parse('twisted')

So I looked around on the internet and finally installed twisted but still the same error.
Anyone has an idea?

[anthony@localhost ldtp2]$ pip install twisted
Requirement already satisfied: twisted in /home/anthony/.local/lib/python3.6/site-packages
Requirement already satisfied: zope.interface>=4.4.2 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: constantly>=15.1 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: hyperlink>=17.1.1 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: Automat>=0.8.0 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: attrs>=19.2.0 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: typing-extensions>=3.6.5 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: incremental>=21.3.0 in /home/anthony/.local/lib/python3.6/site-packages (from twisted)
Requirement already satisfied: setuptools in /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages (from zope.interface>=4.4.2->twisted)
Requirement already satisfied: idna>=2.5 in /home/anthony/.local/lib/python3.6/site-packages (from hyperlink>=17.1.1->twisted)
Requirement already satisfied: six in /home/anthony/.local/lib/python3.6/site-packages (from Automat>=0.8.0->twisted)
You are using pip version 9.0.1, however version 22.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[anthony@localhost ldtp2]$

Stability issues of ldtp client: get httplib.CannotSendRequest or httplib.ResponseNotReady exceptions during long running

I got a fix as bellow in /ldtp/client.py: add 196-200 line.
I am not sure it's a good solution, just report here, if anyone else got same issues, just try this fix.

196             except httplib.CannotSendRequest:
197                 if hasattr(self, 'close'):
198                     self.close()
199             except httplib.ResponseNotReady:
200                 pass
201             except xmlrpclib.Fault as e:
202                 if hasattr(self, 'close'):
203                     self.close()
204                 if e.faultCode == ERROR_CODE:
205                     raise LdtpExecutionError(e.faultString.encode('utf-8'))
206                 else:
207                     raise e

socket.error: [Errno 99] Cannot assign requested address

Hi,
I receive a socket error when trying to import LDTP in python. However if I start LDTP in a second terminal then attempt the import via python again it's successful.

issue

Environment details:
Debian 7.8
Python 2.7.9
LDTP 3.5.0 (from source)

I can see the three required python libs in my python module list (python-atspi, twisted-web, python-gnome).

Any tips on resolving this?
Thanks, Chris

Trying to register gtype 'WnckWindowState' as flags when in fact it is of type 'GEnum''

[hpcuser@Order1 ~]$ python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from ldtp import *

** (-c:338): WARNING **: Trying to register gtype 'WnckWindowState' as flags when in fact it is of type 'GEnum'

** (-c:338): WARNING **: Trying to register gtype 'WnckWindowActions' as flags when in fact it is of type 'GEnum'

** (-c:338): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as flags when in fact it is of type 'GEnum'

My environment is a centos 6.5 docker image. Could you please point me in the right direction where to look for fixing this issue?

Help getting ldtp2 code example working

Hi there -

I'm trying to use the python ldtp library to click the following: Add extension dialog button. I was wondering if someone could point out why this isn't working. Thanks

image

from ldtp import *
import time
import utils
import ldtp


def main():
    driver = utils.get_driver()
    driver.webdriver.get("https://chrome.google.com/webstore/detail/google-calendar/gmbgaklkmjakoegficnlkhebmhkjfich")
    time.sleep(2)
    driver.webdriver.find_element_by_css_selector(
        ".webstore-test-button-label").click()

    time.sleep(2)
    print "HERE"
    if ldtp.activatewindow('Add "Google Calendar"?'):
        print "FOUND"
        ldtp.generatekeyevent('<left><space>')


if __name__ == '__main__':
    main()

socket.error [Erroro 97]

Hi,

There are socket error while I trying to import ldtp.
The error message has followed:
import ldtp

The version of OS is RHEL-6.2.0-x86_64


$ rpm -q redhat-release-server
redhat-release-server-6Server-6.2.0.3.el6.x86_64
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)

Is there anything needs configured?
And how to fix that?

Thanks in advance.

Br. Marslo

How to refresh window list immediately

Hi, I am using ldtp to test cinnamon system settings for linuxmint, but I found the getwindowlist method sometimes don't refresh the window title even though it changed actually. When I click the background icon by generatemouseevent, the getwindowlist method should return 'frmBackgrounds' but it still return 'frmSystemSettings' for me, waittillguiexist does't take effect.Is this a bug or there has some method I don't know to refresh the window title, thanks for any reply.

yilang

Any plan/roadmap to support android platfrom?

Hi,

I am an Android/GoogleTV developer. I think this project is very useful.
There's many times i need to do overnight test against LiveTV player, once there's a blackscreen or system no response, the logcat procedure should be paused/the log should be staged as another snapshot point for later debug work.

So do you have any plan to support android platform? ASAIK, there're ruby/python runtimes on Android(third-party ported, maybe not full-featured) now.

Or what's the main effort to [partial] port this project to android platform?

Thanks,
faywong

enterstring method does not work with "<" character

I am unable to input the "<" character using the enterstring method:

>>> ldtp.enterstring("frmWindow", "txtField", ">")
1

>>> ldtp.enterstring("frmWindow", "txtField", "<")
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/ldtp/client.py", line 70, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request verbose=self.__verbose File "/usr/lib/python2.7/dist-packages/ldtp/client.py", line 187, in request raise e xmlrpclib.Fault: <Fault 8002: 'string index out of range'>

(all special characters minus "<")
>>> ldtp.enterstring("frmWindow", "txtField", "~!@#$%^&*()_+=-,./?[]{}|")
1

(now including "<")
>>> ldtp.enterstring("frmWindow", "txtField", "~!@#$%^&*()_+=-,./?[]{}|<>")
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/ldtp/client.py", line 70, in __call__ return self.__send(self.__name, args) File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request verbose=self.__verbose File "/usr/lib/python2.7/dist-packages/ldtp/client.py", line 187, in request raise e xmlrpclib.Fault: <Fault 8002: "'KeyComboAction' object has no attribute '_func'">

Any idea how to get a list of menu items in GEdit ?

I've been playing with Gedit. What I want to check is that my menu items under the tools menu are available (it's a submenu: Shoebot, with another submenu: Examples).

The aim would be to verify the structure of the menu is there.

I can look for individual items, and verify the Tools menu exists, but any idea how to get the list of items in a menu ?

import ldtp

ldtp.launchapp('gedit')
ldtp.click('*-gedit', 'tbtnMenu')


>>> ldtp.listsubmenus('*-gedit', 'Tools')
[]


ldtp.selectmenuitem('*-gedit', 'Quit')

CentOs 6 works not well with ldtp

I install LDTP on CentOS6,
There are errors:
[root@localhost Desktop]# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from ldtp import *

** (-c:51427): WARNING **: Trying to register gtype 'WnckWindowState' as flags when in fact it is of type 'GEnum'

** (-c:51427): WARNING **: Trying to register gtype 'WnckWindowActions' as flags when in fact it is of type 'GEnum'

** (-c:51427): WARNING **: Trying to register gtype 'WnckWindowMoveResizeMask' as flags when in fact it is of type 'GEnum'

and can not work.How Can I do with it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.