How to Automate Web Applications

Modified on Tue, 3 Sep at 10:47 AM

TABLE OF CONTENTS

1. Prerequisites

2. Profile the application

3. Generate and Execute Scripts 

4. Related Articles


This article provides the instructions to automate web applications using Java Selenium Framework.



Use case:  Amazing shopping journey: Verifying the cart details


In this use case, you are shopping for a new laptop on an amazon website, making selections based on specific requirements, such as brand, filtering options, adding items to the cart, and proceeding to check out for a purchase.


Leveraging algoQA, you can perform the following:

1. Prerequisites

  • Use algoScraper for Application Scraping
    • The algoScraper tool, available as a Chrome extension, serves the purpose of capturing all User Interface (UI) elements and X-paths present on a web page. To integrate this tool into your Chrome or Edge browser, Click here.
    • Scrape all the required UI elements and download the file in the CSV format. For more information on scraping UI elements and tool information, see algoScraper as an Extension Tool for Chrome or Edge Users.
    • The downloaded spreadsheet contains comprehensive details of UI elements details. 
Tip: Ensure that all page names in the scraped file are same as the UI elements’ names.

 

2. Profile the application

Profiling is the process of creating an offline model of an application under test (AUT), which involves mimicking a UI model of an AUT using nodes, features and UI elements.


Profiling involves: 

  • Create an Offline Model - To create an offline model, see Profiling article.

  • Recording the scenarios using FollowMe feature

    Follow Me feature is used to record and save the workflow or scenario or use case. Scenario will be saved in the same sequence it has been recorded.


Note: Recording for the FollowMe feature is done in an offline model. It doesn’t interact with the live application.


For more information, see Follow Me section in the Profiling article. 

  • Generating Test Cases
    Test cases are generated in Gherkin language and are Behavior-driven development (BDD) compliant.

            For more information, see Generate Test cases section in the Profiling article.

3. Generate and Execute Scripts 

Perform the following:

  1. In the Main Canvas, click Script Generation button.
  2. In the Script Generation screen, navigate to the appropriate folder.
  3. Ensure to select both the files generated in the Test Cases folder. If you happen to select either Feature File or  Spreadsheet file in XLSX/XLS format, then you will see the following error message: 
  4.  Click Analyze button. 


  5. In the pop-up window, click 'Proceed' to highlight the Generate Script button.
  6. Click Generate Script.
  7. Scripts are generated successfully with the specified report, as shown. Click the Close button.
  8. Execution of scripts on a windows machine: 
    1. Download and extract the script to your local folder.  Navigate to the same folder.
    2. In the folder navigation bar, type cmd  and press 'Enter' to view the Command Prompt screen.
    3. Run the following command to trigger the script:
      mvn test
      This command will execute the script using Maven, as shown: 
    4. Wait until the Build Success message is displayed, which indicates that scripts have been executed successfully. 
    5. You can view the respective report in the Output folder, as shown: 
    6. Reports will be generated in Spark and PDF formats, as shown: 
    7. The sample PDF report is shown in the attached image. It includes the following details:
      • Test Results: Number of test cases that passed and failed.
      • Execution Time: Total duration taken to execute features, scenarios and steps.
      • Step Details: You can view preceding Information for each test step by clicking the feature name link.
      • Screenshots: You can also view screenshots for each verification step.

4. Related Articles

Displaying Timestamps for Generated Script Folders to Identify Concurrent Users' Actions.







Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article