STQA 2 Ajy
STQA 2 Ajy
Practical - 7
AIM: Using Selenium IDE, Write a test suite containing minimum 4 test cases
DESCRIPTION:
This experiment focuses on using Selenium IDE to automate web testing. The goal is to create a
test suite with at least four test cases, checking key functions like login and form submission. By
automating these, the experiment aims to catch bugs early and ensure reliable software
performance. The test suite will verify that the web app works as expected under different
conditions
TEST CASES:
• Objective: Validate that a user can submit a form with all required fields.
• Steps: Navigate to form page > Fill in the required fields > Click 'Submit'.
• Expected Result: Confirmation message appears: "Form submitted successfully".
ADVANTAGES:
• User-Friendly: Selenium IDE offers a simple, record-and-playback feature, making it
accessible even to testers with minimal coding skills.
• Quick Test Creation: Tests can be created rapidly by recording user interactions with the
application.
• Open Source: Selenium IDE is free, making it a cost-effective option for automating web
testing.
• Cross-Browser Support: It can execute tests across different browsers like Chrome,
Firefox, etc., ensuring cross-browser compatibility.
• No Setup Required: Easy to install as a browser extension, it requires no complex setup
to start using.
DISADVANTAGES:
• Limited to Web Applications: Selenium IDE can only test web applications and not
desktop or mobile applications.
• Maintenance Effort: Recorded test scripts can be fragile and require constant maintenance
if the web application's UI changes frequently.
• No Support for Complex Logic: It's less flexible for handling advanced logic, conditional
statements, or loops, compared to Selenium WebDriver.
• Not Ideal for Large Projects: For large, scalable projects, Selenium IDE can become
cumbersome as it lacks powerful features like custom programming and data-driven
testing.
• Limited Debugging Features: Debugging capabilities are more basic, making it difficult
to handle complex failures during test runs.
CONCLUSION:
In conclusion, automating the login process for a specific web page using Selenium provides a
powerful means of enhancing testing efficiency and accuracy in web applications. By simulating
user interactions, Selenium facilitates thorough validation of authentication mechanisms, ensuring
reliability in user experience. Despite the challenges of maintenance and potential performance
concerns, the benefits of cross-browser compatibility, open-source accessibility, and integration
with various programming languages make Selenium a valuable tool in the realm of software
testing. This endeavor not only strengthens understanding of automated testing practices but also
contributes to the overall quality assurance efforts in web development.
Practical - 8
AIM: Install Selenium server and demonstrate it using a script in Java/PHP
DESCRIPTION:
This experiment involves installing the Selenium server to facilitate automated web testing using
Java or PHP. The primary objective is to set up the server environment that allows for the execution
of Selenium scripts, enabling interaction with web browsers for automated testing. The
demonstration includes writing a simple script to automate a web task, showcasing how Selenium
can be leveraged to enhance testing efficiency and accuracy. This project serves as an introduction
to using Selenium for browser automation, illustrating its capabilities in streamlining testing
processes in software development.
STEPS:
Step 1: Install Selenium Server
1. Download Selenium Server:
• Visit the Selenium downloads page.
• Download the latest version of Selenium Server (usually a .jar file).
2. Install Java:
• Ensure that you have Java installed on your system. You can check this by
running java -version in the command line. If it's not installed, download and
install the Java Development Kit (JDK) from the Oracle website or adopt
OpenJDK.
CONCLUSION:
By following these steps, you can successfully install Selenium Server and create a script in either
Java or PHP to demonstrate its capabilities. This setup allows you to automate browser interactions
and conduct testing efficiently.
Practical - 9
AIM: Write and test a program to login a specific web page
DESCRIPTION:
This task focuses on writing and testing a program that automates the login process for a specific
web page using Selenium WebDriver. The objective is to develop a script that launches a web
browser, navigates to the login page, enters the required credentials, and submits the login form.
By verifying successful login through checks such as page titles or URLs, this program aims to
streamline the testing process for web applications, ensuring reliability and efficiency in user
authentication scenarios.
• Choose a specific web page that requires login (e.g., a demo site or a personal
project).
2. Set Up Environment:
• Install necessary tools (e.g., Selenium WebDriver for your chosen programming
language).
• Set up the development environment (Java/PHP/Python, etc.).
• Use Selenium to automate the login process. The script should include:
o Launching the browser.
o Navigating to the login page.
o Locating the username and password fields.
o Entering credentials and submitting the form.
• After logging in, confirm that you are redirected to the appropriate dashboard or
landing page.
CODE:
ADVANTAGES:
DISADVANTAGES:
• Maintenance Overhead: Selenium scripts can require frequent updates due to changes in
the web application's UI, leading to ongoing maintenance costs.
• Limited Support for Dynamic Content: Handling dynamic web elements (like AJAX)
can be challenging and may require additional code for waits and synchronization.
• Steeper Learning Curve: While Selenium is powerful, it may have a steeper learning
curve for those new to programming or automated testing, requiring familiarity with coding
concepts.
• Performance: Selenium tests can be slower compared to other testing methods, especially
for extensive test suites, due to the overhead of launching browsers and executing scripts.
CONCLUSION:
In conclusion, automating the login process for a specific web page using Selenium provides a
powerful means of enhancing testing efficiency and accuracy in web applications. By simulating
user interactions, Selenium facilitates thorough validation of authentication mechanisms, ensuring
reliability in user experience. Despite the challenges of maintenance and potential performance
concerns, the benefits of cross-browser compatibility, open-source accessibility, and integration
with various programming languages make Selenium a valuable tool in the realm of software
testing. This endeavor not only strengthens understanding of automated testing practices but also
contributes to the overall quality assurance efforts in web development.
Practical - 10
AIM: Write and test a program to provide total number of objects present / available
on the page.
DESCRIPTION:
This practical focuses on writing and testing a program that counts the total number of specific
objects present on a web page using Selenium WebDriver. The objective is to develop a script that
navigates to a designated web page, locates the desired objects (such as images, links, or buttons),
and accurately counts them. By automating this process, the program enhances efficiency in data
extraction and analysis while providing valuable insights into the web page's content structure.
STEPS:
1. Select a Web Page:
• Choose a specific web page where you want to count the objects (e.g., images,
buttons, or any specific HTML elements).
2. Set Up Environment:
• Install necessary tools (e.g., Selenium WebDriver).
• Set up the development environment (Java/PHP/Python, etc.).
CODE:
CONCLUSION:
In conclusion, developing a program to count the total number of specific objects on a web page
using Selenium WebDriver exemplifies the power of automation in web data extraction. This
project successfully demonstrates how Selenium can be utilized to streamline the counting process,
providing accurate insights into a web page's structure and content. By automating this task, we
enhance efficiency and reliability, allowing for quicker data analysis and decision-making. The
skills acquired through this endeavor not only reinforce the principles of web scraping but also lay
a solid foundation for future projects involving automated testing and data collection.
Practical - 11
AIM: Write and test a program to update 10 student records into table into Excel
file.
DESCRIPTION:
This project focuses on creating a Python program that updates student records in an Excel file
using the panda’s library. The program reads existing data, modifies the records for 10 students
with new details such as name, age, and grade, and saves the updates back to the file. By
automating this process, the program improves data management efficiency and accuracy,
showcasing the effectiveness of Python for handling Excel data.
STEPS:
1. Set Up Environment:
• Make sure you have pandas and openpyxl installed.
• Install them via pip: pip install pandas openpyxl
DATA:
CODE:
• Load the Excel File: The program starts by loading the existing Excel file containing the
student records.
• Display Current Records: It prints the current records to provide a reference before
updating.
• Update Records: A dictionary named updates holds the new details for each student. The
program iterates through this dictionary and updates the corresponding records in the
DataFrame.
• Save Changes: After updating, the program saves the changes back to the same Excel file.
• Display Updated Records: Finally, it prints the updated records to verify that the changes
were made successfully.
CONCLUSION
In conclusion, this project successfully demonstrates the automation of updating student records
in an Excel file using Python and the panda’s library. By implementing a program that efficiently
reads, modifies, and saves data, we enhance data management processes while ensuring accuracy
and consistency in record-keeping. The ability to automate such tasks not only saves time but also
reduces the likelihood of human error, showcasing the practical applications of Python for data
manipulation. This project serves as a valuable step towards mastering data handling techniques
and reinforces the importance of automation in modern data management.