Intents

9 views
Skip to first unread message

Andre Steenkamp

unread,
Oct 26, 2023, 10:25:34 AM10/26/23
to sele...@googlegroups.com


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.


Andrei Solntsev

unread,
Oct 27, 2023, 6:44:19 AM10/27/23
to Andre Steenkamp, sele...@googlegroups.com
Hi Andre!
I personally haven't tried it, but you can google for "How to send intent in Appium java".
Everything that Appium can do, Selenide also can do. 


Andrei Solntsev


чт, 26 окт. 2023 г. в 17:25, Andre Steenkamp <An...@switch.tj>:
--
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.

Andre Steenkamp

unread,
Oct 27, 2023, 7:08:28 AM10/27/23
to Andrei Solntsev, sele...@googlegroups.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 
Reply all
Reply to author
Forward
0 new messages