Is there a way to automate the clicking (opening,clicking certain button of the application and finally closing it) with some script or an android application.
Depends on what you're trying to do. For UI testing of your app you can use the build-in support, have a look at http://developer.android.com/training/activity-testing/activity-ui-testing.html or perhaps look into the UI automation tool.
If what you want to do is emulate user events on any given app, you could use adb to send key or touch events, but it would be a on a very low level
For example:
adb shell input keyevent 3
Would emulate pressing the home key.
You could also do
adb shell input tap 50 50
to emulate a touch event at the given coordinate.
You can use uiautomator (requires API 16+).
Robotium (which also uses the Android testing framework) is another great testing framework for UI. Same goes for Espresso. You can then write JUnit 3 tests for your app.
Related
Coming from a desktop and web background, I am familiar with tools that allow me to record mouse movements and keystrokes for Functional test.
What for Android apps? Is there any similar tool or tools? I assume with a device connected to your PC/Mac (emulator), but also simply on the device itself.
For the later, which is what I'm trying to accomplish, I would like to be able to record movements on the screen (just as in the eclipse emulator), i.e. swiping up, down, button on press, on release, etc., and simply have it run on the device itself without being connected to a computer, similar to being able to record a script (functional) and run it over and over, having this installed as an app on the device to allow me to record and run functional scripts as an overlay on top of an app in development?
Like being able to run something like MonkeyTalk directly on the device.
Think of being able to record and run Selenium functional scripts directly on and from the device.
Is there an overlay type of idea that would work? I've heard there are some security risks in this.
Looking for a solution please.
I suppose Espresso Test Recorder is exactly what you are looking for.
Is there a way to emulate whatever operation we perform on phone to be displayed in desktop/laptop.
When my physical device is connected to my desktop/laptop, i want an emulator like feature displayed, where whatever operations i perform on phone should be displayed in the emulator.
Can we do this?
If we have any such feature, can they both be synched? meaning if i press some operation on emulator, the operation should be performed on phone.
I heard that, these can be supported like cloud based platforms like perfecto, xamarian, seetest etcc...? How they are achieving this?
Have you tried Genymotion Link HereIt is good emulator where you can download any one model of the phone and you can do whatever you like on phonebo.
other one is Mobogenie,these are two sort of emulators with different operations.
Play store app is used to remotely project your android device on a bigger screen ,but main problem is that your phone must be rooted.
If you are using lollipop see thisHere,it has inbuilt feature
Is there are way to fake mouse and keyboard input on Android?
I developed an application for controlling computers with a smartphone client and since smart TVs become more interesting for people I would also be very interested in providing a server for Android.
I already discovered monkeyrunner but I'm not sure whether this is really what I want since it is a development tool. A native way would be far more attractive.
Has anyone already experimented with this? I use Qt so a C++ way would be great. I have also seen someone faking key inputs per command line is there a way to execute command line commands in an Android application?
Is there are way to fake mouse and keyboard input on Android?
Only via custom firmware, a rooted device, or via the Android SDK tools. Apps cannot attack other apps via "fake mouse and keyboard input" for obvious security reasons.
I have also seen someone faking key inputs per command line is there a way to execute command line commands in an Android application?
Fortunately, that will not work, unless you run as root.
I would like to write some sort of macro app that presses keys. Would this be possible on IOS and/or Android?
Yes, for android, have you tried MonkeyRunner
The monkeyrunner tool provides an API for writing programs that
control an Android device or emulator from outside of Android code.
With monkeyrunner, you can write a Python program that installs an
Android application or test package, runs it, sends keystrokes to it,
takes screenshots of its user interface, and stores screenshots on the
workstation.
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner? Also, I have the impression that it only works with SDK?
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
If yes, please provide me help on how to start writing python for mobile, and how to make project for android in Python. I have used Eclipse for java for android, but not for python.
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner?
From your development machine, yes. Per your question title, you cannot use MonkeyRunner on a device.
Also, I have the impression that it only works with SDK?
Yes.
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
Fortunately, no, as this would be a massive security hole.
I have the impression that it only works with SDK?
MonkeyRunner uses adb (Android Debug Bridge) which comes with the SDK. However, if you install the SDK, that doesn't mean you also need to start it. You just need the adb tool to interact with your device.
I want to simulate touch event, keyboard event on mobile device. Can I do it with MonkeyRunner?
For key events, here is the list of key events supported by adb:
http://developer.android.com/reference/android/view/KeyEvent.html
These can be directly through adb and will the handled by the app that you have in foreground at that moment, or in some cases, like the Home button, will cause the Task Manager to appear.
If you do wish to use these for functional testing of your app, i recommend avoiding mnemonic menu selection, because menus change, and your scripts will require change also. :)
For Touch events i can recommend you ViewClient or Robotium. Personally, i prefer ViewClient, because it's easier to use.
http://dtmilano.blogspot.ro/2012/02/monkeyrunner-interacting-with-views.html
Mind you that ViewClient requires monkeyrunner. In its source, monkeyrunner is imported:
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
I want the application to be installed on mobile, which will perform some random touch, keyboard events. Is it possible with MonkeyRunner?
You want to use monkey to do this.