简体   繁体   中英

Java, Selenium webdriver TestNG “Pls Help Me”

I have a scenario a single sign on page before a user can get a full access to the secure site, they have to request for a one-time password using the request button on the page, the one password is then sent to their inbox.

First screen user enters username and password and click login then gets to the second screen which they have to request for the one-time password

The script will have to sleep and get.url to email, get the password from email and back to the single sign on page and paste, click on the submit button and secure page is now displayed.

How do I go about writing this script?

I have a pageobject called LoginPage and Testcase called LoginTest

You will need to automate an email. This will mean that you should use a service that connects to email via IMAP or POP (If you don't know what services, check out this answer ).

The process will look something like this:

  1. Login, and have email sent

  2. Connect to email via IMAP/POP3

  3. Get the text of the email (you may have to do parse afterwards)

  4. Type in the code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM