Hi all,
How do I send an intent to an android app using Selenide?
Andre Steenkamp Senior Test Analyst | |
C: +27 82 923 9140 | T: +27 21 525 3100 An...@switch.tj | transactionjunction.co.za | |
The information in this message is confidential and may be legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorised. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it, is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. Thank you.
--
You received this message because you are subscribed to the Google Groups "selenide" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenide+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenide/JNZP275MB1498BBE35FD61AB5012456EFA4DDA%40JNZP275MB1498.ZAFP275.PROD.OUTLOOK.COM.
Hi Andrei,
I actually found that exact same article and managed to send the intent using the below code, which I am sure can be optimized to do better in Selenide.
UiAutomator2Options
options =
new
UiAutomator2Options();
options.setPlatformName("Android");
options.setAutomationName(AutomationName.ANDROID_UIAUTOMATOR2);
options.setDeviceName("andre-test-device");
options.setApp(System.getProperty("user.dir")
+ "/apps/TJPay.apk");
AndroidDriver
driver =
new
AndroidDriver(new
URL(http://0.0.0.0:4723),
options);
try
{
List
intentArgs =
Arrays.asList(
"za.co.transactionjunction.tjpay.android/za.co.transactionjunction.tjpay.android.MainActivity",
"-a",
"android.intent.action.SEND",
"-c",
"android.intent.category.DEFAULT",
"-e",
"amount",
"100",
"-t",
"text/plain"
);
Map
intentCmd =
ImmutableMap
.of("command",
"am start -n",
"args", intentArgs);
driver.executeScript("mobile:
shell", intentCmd);
Andre Steenkamp Senior Test Analyst |
C: +27 82 923 9140 | T: +27 21 525 3100 An...@switch.tj | transactionjunction.co.za |