@lddd
It is the best. Another best is google which gives first link from search is https://github.com/appium/java-client/blob/master/docs/The-event_firing.md49
@Aleksel
thanks but is this only possible to a Java Client? What about JavaScript?
Also is it possible with one Appium Test to process multiple operations on one device at the same time / parallel ?
Lets say i want to automate the following:
- Listen for incoming messages inside the app.
- Sending a message inside the app.
I have no idea how something like this would most likely be realized in the Appium Universe
Appreciate any further help
No idea about javascript. Never used. Open Appium github and look for JavaScript-Client.
Regarding listners. You are talking about some your app. Appium does not care how messagers working inside any private app. All you can do is send some event to device in a way your accept. To move further and start from something - did you manage to send such events to your app manually first? I believe it is also a platform specific e.g. in Android one way in iOS should be another one.
@Aleskel.
No because i could not find how to listen for events for a JS Client…
The main application is based on Node JS. I need Appium because the App doesn’t provide any API and i need to create REST API endpoints for the following
- GET - Fetching incoming messages retrieved in the App.
- PUT - Send messages through the app.
In any case you will be able to listen with Appium ONLY system OS events! Not your app.
Your app should provide api interface how to listen it events and get e.g. count of unread messages. Using this api you first must be able to make it manually using any method. E.g. send. Http get request to url and port that listen your app.
The app does not provide any API. And its not my own app.
The question is how to automatically listen with Appium for a specific action (like an incoming message to the app) and trigger some action like saving the body of the message or what ever.
So basically the Appium “Test” Script should be sit and wait, do nothing until a message comes in to the app, then catch up on this “event” and do something with the message arrived.
So I am not sure what you mean by “manually”?
Please see:
But this is some Java browser automation example using Selenium Webdriver and you cannot save the phone number of the incoming messages to contacts for e.g because you don´t have access to contacts on web.whatsapp.com.
So my idea was to do the same with Appium directly on some emulated device instead.
@lddd you can. but i can not help you with Appium JavaScript. never used it as client for appium.
Ok thanks a lot.
I am very new to both Java and JavaScript
Now 2 more questions:
-
Lets say it´s a Java Client. How to keep such Test running in the background so it´s continuously waiting for new messages and do something with the results? I would have to execute such Client Script every second by cronjob or how is this be done?
-
Would it be possible to do other actions in the same Appium Test like sending a message? What if both actions would happen to the same time? I guess its not possible for Appium to parallel execute two functions on the same App window running only 1 Test for the same device?
thanks for all the kind help so far. Very nice.