OTP verification in Appium - selenium-webdriver

How to read OTP SMS on an android device when doing a login test to another app?
I am currently pausing the test and entering the OTP manually and running the test. But I want to automate it.
There are some methods to read an SMS body but I don't know how to open the messaging app and read the body while running another app.
Can anyone help me?

Appium and Selenium can easily run the JavaScript commands, so the easiest way is:
sms_inbox = driver.execute_script("mobile: listSms")
sms_list = sms_inbox['items']

Related

how to send email directly in React Native App

I am progromming about function: send Email to gmail Address directly from React native App.
I searched on Internet and try library: https://github.com/anarchicknight/react-native-communications, https://github.com/chirag04/react-native-mail.
Howerver, they only show me view of Gmail App which I installed in my device.
I want react native app will send directly to Address Email.
My device I tested run on Android Platform.
Thank you so much
You need an email server or an email services to send an email, there is no way you can send an email directly from the client side.
There are several of them in the internet, you can try: MailGun or SendPulse, they got some good free tiers.
Your job is just calling a simple POST method from your app to their APIs.
I have tried, and so far succeeded in testing with iOS, with react-native-email ("npm install react-native-email").
There is a bit of fluffing around when sending the first email as you have to "login" to your email account. But otherwise, test emails are going through fine.
Also, SendPulse is a bulk newsletter service, not for individual emails.
One annoying caveat: it won't work in your emulator. It will return a URL error when you click the send button. But it works fine on a real device. I'm using Expo (and who wouldn't) and it works fine on my iPhone.
Complete code for testing purposes here: https://github.com/tiaanduplessis/react-native-email

How do i send an automatic mail after the execution of suite in selenium

For my project an Email should be sent automatically with the results attained after execution of Suite in selenium. Can anyone help me with this?
Hi answer to this question depends on the perspective
1.if you are running in continuous integration with jenkins please configure your jenkins it will send mail to the sender automatically once the job is done.
2.if you are using TestNG or jUnit then you can configure your mailer in
#AfterTest
public void SendMail(){ // your code to send mail e.g gmail. }
Hope this helps you.
Please go through the below detailed steps to send automatic emails after selenium test execution,this post is available in the official Selenium blogs as well.
http://www.assertselenium.com/java/emailable-reports-for-selenium-scripts/

How to automate window page login using selenium

In my web based application login form is window popup ,so that its not possible to automate using selenium webdriver , i have tried using robot class but didn't get the result, can any one suggest a solution for it.
if its authentication then you can try sending username password in URL. Also take a look at AutoIT for such cases.
EDIT: It depends on the type of authentication like HTTP / HTTPS so on and so-forth
One example can be this: https://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters/371918

Google 2-step verification - AngularJS - Automation failing

I am automating a web portal using AngularJS with protractor which uses google 2 step verification after you click on login. The 2 step verification sends a text message to the text phone we are using.
My Scripts are failing in the 2 step verification process as it requires manual intervention. This is a must to have and cannot remove it. How can one work around this 2 step verification process? If anyone knows, Please let me know.

Invoking SMS composition in the simulator

Following the BlackBerry documentation on the Invocation Framework, I'm trying to invoke opening a contact, and SMS and E-mail composing. The contact opening works fine, but I cannot get the SMS and E-mail composition to work in the Simulator. The code is being executed, but nothing happens. Any ideas what can I be doing wrong?
Here's a piece of the code I'm using:
InvokeRequest request;
request.setAction("bb.action.COMPOSE");
request.setMimeType("message/rfc822");
request.setTarget("sys.pim.uib.email.hybridcomposer");
QByteArray ba(list.toUtf8());
request.setData(ba);
m_invokeManager->invoke(request);
Thanks for any hints!
I am also facing this issue.
SMS and E-mail is not working simulator because SMS/Email app is not installed in simulator.
You have to test in device.
Below code is working fine in device for me..
Send SMS:
InvokeRequest invokeRequest;
invokeRequest.setTarget("sys.pim.text_messaging.smsuri");
invokeRequest.setAction("bb.action.OPEN");
invokeRequest.setUri("sms:4444");
invokeRequest.setMimeType("*");
Send Email:
InvokeRequest invokeRequest;
invokeRequest.setTarget("sys.pim.uib.email.hybridcomposer");
invokeRequest.setAction("bb.action.COMPOSE");
invokeRequest.setUri("mailto:info#google.com");
invokeRequest.setMimeType("message/rfc822")
Thanks..

Resources