Activity: Automating Checkout

Scenario

Our website includes a checkout to complete the ordering process. We want to make sure that the checkout is working properly for our customers. For now, we will interact with each of the elements on the page, then fill them with data by using Java.

Aim

To reinforce what was learned in previous chapters by interacting with elements. You will practice element location through a real-life use case.

Steps for Completion

  1. Open https://trainingbypackt.github.io/Beginning-Selenium/lesson_4/activity_4_C-1.html in Chrome.
  2. Open the Chrome DevTools JavaScript to inspect the elements.
  3. Locate the first name and last name fields, and write appropriate values on them. Each one has a unique ID.
  4. Repeat step 2 for the following fields: email, address, zip, name on card, card number, expiration, and CVV.
  5. Locate the drop-down field to select the country, and select one.
  6. Locate the checkbox, Save information for next time, and click on it.
  7. Locate and select one of the payment methods. Consider that there are no unique IDs for them; a good option would be to use a CSS selector with a partial match, to find a good locator.
  8. Locate and click on the Pay button.
  9. Collect all of the code pieces that you have built while interacting with the page elements, and combine them in a Java class called CheckoutForm.
  10. Run the application by navigating to Run | Run… | CheckoutForm, and observe how your automated script interacts with a checkout form.

To refer to the detailed steps, go to the Solutions section at the end of 
this book on Page no. 169.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.47.221