uiautomator
uiautomator copied to clipboard
Double and Triple Click / Tap ?!
There is no functionality for Double and Triple Click / Tap, its simple to change in server rite Please change and let me know your repo client uiautomator.py So that I can use it
No comments on this? Atleast say any workaround for this please!
I didn't use double click before. Is it possible to call click twice on uiautomator?
UiObject selectImage = new UiObject(new UiSelector().className("android.widget.RelativeLayout").index(3)); Configurator cc = Configurator.getInstance(); cc.setActionAcknowledgmentTimeout(40); selectImage.click(); selectImage.click();
This does the Job in Java UIAutomator Is this possible to be added? Barely needed
I want triple click also... Please add that also in your list of todos
Thank @gokulakv, I will add it.
If it's possible please add it soon and give local version, as it's very crucial for our project. If you don't mind, is there an ETA for this?
-----Original Message----- From: ºØÏþ´Ï [[email protected]] Received: Wednesday, 02 Jul 2014, 20:05 To: xiaocong/uiautomator [[email protected]] CC: V, Gokulakrishnan [[email protected]] Subject: Re: [uiautomator] Double and Triple Click / Tap ?! (#53)
Thank @gokulakvhttps://github.com/gokulakv, I will add it.
¡ª Reply to this email directly or view it on GitHubhttps://github.com/xiaocong/uiautomator/issues/53#issuecomment-47783801.
Please refer to below code and check if it can resolve your case.
def double_click(*args, **kwargs):
# set ack timeout
config = d.server.jsonrpc.getConfigurator()
config['actionAcknowledgmentTimeout'] = 40
d.server.jsonrpc.setConfigurator(config)
# double click
d(*args, **kwargs).click()
d(*args, **kwargs).click()
# restore previous config
config['actionAcknowledgmentTimeout'] = 3000
d.server.jsonrpc.setConfigurator(config)
Notes: Configurator requires Android 4.3+
Likewise I want another module: TRIPLE CLICK Yea these two should solve mine
Yea atlast let me know how to update these changes into my code framework
from uiautomator import device as d
# define double click function
def double_click(*args, **kwargs):
# set ack timeout
config = d.server.jsonrpc.getConfigurator()
config['actionAcknowledgmentTimeout'] = 40
d.server.jsonrpc.setConfigurator(config)
# double click
d(*args, **kwargs).click()
d(*args, **kwargs).click()
# restore previous config
config['actionAcknowledgmentTimeout'] = 3000
d.server.jsonrpc.setConfigurator(config)
# call the function on view with text ...
double_click(text='...')
No Server / Build Changes needed huh? I thought I had to build again
Hey, Do we have to import anything? because I see that the Configurator class is not detected.
@yeshwanth24,
Please make sure:
- Install py-uiautomator using
pip install uiautomator
. It will install the jsonrpc jar files with py-uiautomator package. - Do not launch jsonrpc server by yourself. py-uiautomator will launch correct jsonrpc server for you.
If you meet the issue again, please help upload the logcat when you are running the script, else I could not help you on this.
Hi @xiaocong
My double tap is not working , below code I am using for it. It always does the single click.
config = d.server.jsonrpc.getConfigurator() config['actionAcknowledgmentTimeout'] = 40 d.server.jsonrpc.setConfigurator(config) d(ELEMENT).click() d(ELEMENT).click() config['actionAcknowledgmentTimeout'] = 3000 d.server.jsonrpc.setConfigurator(config)
Hi @xiaocong @sudhuhegde it is working , i add xiaocong 's code( just changed a little) to uiautomator.py as:
def double_click(self, x=500, y=500): config = self.server.jsonrpc.getConfigurator() config['actionAcknowledgmentTimeout'] = 40 self.server.jsonrpc.setConfigurator(config) self.click(x, y) self.click(x, y) config['actionAcknowledgmentTimeout'] = 3000 self.server.jsonrpc.setConfigurator(config)
then, it worked very well.
for i in xrange(1,3):
d.click()
sleep(0.01)
This works for me. You should sleep a while after click the view . @yanglikai0806 @yeshwanth24
Hi @xiaocong
I tried running your code
def double_click(*args, **kwargs): # set ack timeout config = d.server.jsonrpc.getConfigurator() config['actionAcknowledgmentTimeout'] = 40 d.server.jsonrpc.setConfigurator(config) # double click d(*args, **kwargs).click() d(*args, **kwargs).click() # restore previous config config['actionAcknowledgmentTimeout'] = 3000 d.server.jsonrpc.setConfigurator(config) #calling the function
double_click(resourceId="com.amazon.photos:id/photo_view")
But i am getting an error as
Traceback (most recent call last):
File "C:/Users/dikaushi/PycharmProjects/Amozon_Pheripharals_Automation0.1/Module_TestScripts/TestScripts.py", line 133, in
Process finished with exit code 1
Could you tell me what is this issue
@ananthandivya You need to use device instance. Instead of config = self.server.jsonrpc.getConfigurator()
use config = d.server.jsonrpc.getConfigurator()