- Blog Categories
- Software Development Projects and Ideas
- 12 Computer Science Project Ideas
- 28 Beginner Software Projects
- Top 10 Engineering Project Ideas
- Top 10 Easy Final Year Projects
- Top 10 Mini Projects for Engineers
- 25 Best Django Project Ideas
- Top 20 MERN Stack Project Ideas
- Top 12 Real Time Projects
- Top 6 Major CSE Projects
- 12 Robotics Projects for All Levels
- Java Programming Concepts
- Abstract Class in Java and Methods
- Constructor Overloading in Java
- StringBuffer vs StringBuilder
- Java Identifiers: Syntax & Examples
- Types of Variables in Java Explained
- Composition in Java: Examples
- Append in Java: Implementation
- Loose Coupling vs Tight Coupling
- Integrity Constraints in DBMS
- Different Types of Operators Explained
- Career and Interview Preparation in IT
- Top 14 IT Courses for Jobs
- Top 20 Highest Paying Languages
- 23 Top CS Interview Q&A
- Best IT Jobs without Coding
- Software Engineer Salary in India
- 44 Agile Methodology Interview Q&A
- 10 Software Engineering Challenges
- Top 15 Tech's Daily Life Impact
- 10 Best Backends for React
- Cloud Computing Reference Models
- Web Development and Security
- Find Installed NPM Version
- Install Specific NPM Package Version
- Make API Calls in Angular
- Install Bootstrap in Angular
- Use Axios in React: Guide
- StrictMode in React: Usage
- 75 Cyber Security Research Topics
- Top 7 Languages for Ethical Hacking
- Top 20 Docker Commands
- Advantages of OOP
- Data Science Projects and Applications
- 42 Python Project Ideas for Beginners
- 13 Data Science Project Ideas
- 13 Data Structure Project Ideas
- 12 Real-World Python Applications
- Python Banking Project
- Data Science Course Eligibility
- Association Rule Mining Overview
- Cluster Analysis in Data Mining
- Classification in Data Mining
- KDD Process in Data Mining
- Data Structures and Algorithms
- Binary Tree Types Explained
- Binary Search Algorithm
- Sorting in Data Structure
- Binary Tree in Data Structure
- Binary Tree vs Binary Search Tree
- Recursion in Data Structure
- Data Structure Search Methods: Explained
- Binary Tree Interview Q&A
- Linear vs Binary Search
- Priority Queue Overview
- Python Programming and Tools
- Top 30 Python Pattern Programs
- List vs Tuple
- Python Free Online Course
- Method Overriding in Python
- Top 21 Python Developer Skills
- Reverse a Number in Python
- Switch Case Functions in Python
- Info Retrieval System Overview
- Reverse a Number in Python
- Real-World Python Applications
- Data Science Careers and Comparisons
- Data Analyst Salary in India
- Data Scientist Salary in India
- Free Excel Certification Course
- Actuary Salary in India
- Data Analyst Interview Guide
- Pandas Interview Guide
- Tableau Filters Explained
- Data Mining Techniques Overview
- Data Analytics Lifecycle Phases
- Data Science Vs Analytics Comparison
- Artificial Intelligence and Machine Learning Projects
- Exciting IoT Project Ideas
- 16 Exciting AI Project Ideas
- 45+ Interesting ML Project Ideas
- Exciting Deep Learning Projects
- 12 Intriguing Linear Regression Projects
- 13 Neural Network Projects
- 5 Exciting Image Processing Projects
- Top 8 Thrilling AWS Projects
- 12 Engaging AI Projects in Python
- NLP Projects for Beginners
- Concepts and Algorithms in AIML
- Basic CNN Architecture Explained
- 6 Types of Regression Models
- Data Preprocessing Steps
- Bagging vs Boosting in ML
- Multinomial Naive Bayes Overview
- Gini Index for Decision Trees
- Bayesian Network Example
- Bayes Theorem Guide
- Top 10 Dimensionality Reduction Techniques
- Neural Network Step-by-Step Guide
- Technical Guides and Comparisons
- Make a Chatbot in Python
- Compute Square Roots in Python
- Permutation vs Combination
- Image Segmentation Techniques
- Generative AI vs Traditional AI
- AI vs Human Intelligence
- Random Forest vs Decision Tree
- Neural Network Overview
- Perceptron Learning Algorithm
- Selection Sort Algorithm
- Career and Practical Applications in AIML
- AI Salary in India Overview
- Biological Neural Network Basics
- Top 10 AI Challenges
- Production System in AI
- Top 8 Raspberry Pi Alternatives
- Top 8 Open Source Projects
- 14 Raspberry Pi Project Ideas
- 15 MATLAB Project Ideas
- Top 10 Python NLP Libraries
- Naive Bayes Explained
- Digital Marketing Projects and Strategies
- 10 Best Digital Marketing Projects
- 17 Fun Social Media Projects
- Top 6 SEO Project Ideas
- Digital Marketing Case Studies
- Coca-Cola Marketing Strategy
- Nestle Marketing Strategy Analysis
- Zomato Marketing Strategy
- Monetize Instagram Guide
- Become a Successful Instagram Influencer
- 8 Best Lead Generation Techniques
- Digital Marketing Careers and Salaries
- Digital Marketing Salary in India
- Top 10 Highest Paying Marketing Jobs
- Highest Paying Digital Marketing Jobs
- SEO Salary in India
- Brand Manager Salary in India
- Content Writer Salary Guide
- Digital Marketing Executive Roles
- Career in Digital Marketing Guide
- Future of Digital Marketing
- MBA in Digital Marketing Overview
- Digital Marketing Techniques and Channels
- 9 Types of Digital Marketing Channels
- Top 10 Benefits of Marketing Branding
- 100 Best YouTube Channel Ideas
- YouTube Earnings in India
- 7 Reasons to Study Digital Marketing
- Top 10 Digital Marketing Objectives
- 10 Best Digital Marketing Blogs
- Top 5 Industries Using Digital Marketing
- Growth of Digital Marketing in India
- Top Career Options in Marketing
- Interview Preparation and Skills
- 73 Google Analytics Interview Q&A
- 56 Social Media Marketing Q&A
- 78 Google AdWords Interview Q&A
- Top 133 SEO Interview Q&A
- 27+ Digital Marketing Q&A
- Digital Marketing Free Course
- Top 9 Skills for PPC Analysts
- Movies with Successful Social Media Campaigns
- Marketing Communication Steps
- Top 10 Reasons to Be an Affiliate Marketer
- Career Options and Paths
- Top 25 Highest Paying Jobs India
- Top 25 Highest Paying Jobs World
- Top 10 Highest Paid Commerce Job
- Career Options After 12th Arts
- Top 7 Commerce Courses Without Maths
- Top 7 Career Options After PCB
- Best Career Options for Commerce
- Career Options After 12th CS
- Top 10 Career Options After 10th
- 8 Best Career Options After BA
- Projects and Academic Pursuits
- 17 Exciting Final Year Projects
- Top 12 Commerce Project Topics
- Top 13 BCA Project Ideas
- Career Options After 12th Science
- Top 15 CS Jobs in India
- 12 Best Career Options After M.Com
- 9 Best Career Options After B.Sc
- 7 Best Career Options After BCA
- 22 Best Career Options After MCA
- 16 Top Career Options After CE
- Courses and Certifications
- 10 Best Job-Oriented Courses
- Best Online Computer Courses
- Top 15 Trending Online Courses
- Top 19 High Salary Certificate Courses
- 21 Best Programming Courses for Jobs
- What is SGPA? Convert to CGPA
- GPA to Percentage Calculator
- Highest Salary Engineering Stream
- 15 Top Career Options After Engineering
- 6 Top Career Options After BBA
- Job Market and Interview Preparation
- Why Should You Be Hired: 5 Answers
- Top 10 Future Career Options
- Top 15 Highest Paid IT Jobs India
- 5 Common Guesstimate Interview Q&A
- Average CEO Salary: Top Paid CEOs
- Career Options in Political Science
- Top 15 Highest Paying Non-IT Jobs
- Cover Letter Examples for Jobs
- Top 5 Highest Paying Freelance Jobs
- Top 10 Highest Paying Companies India
- Career Options and Paths After MBA
- 20 Best Careers After B.Com
- Career Options After MBA Marketing
- Top 14 Careers After MBA In HR
- Top 10 Highest Paying HR Jobs India
- How to Become an Investment Banker
- Career Options After MBA - High Paying
- Scope of MBA in Operations Management
- Best MBA for Working Professionals India
- MBA After BA - Is It Right For You?
- Best Online MBA Courses India
- MBA Project Ideas and Topics
- 11 Exciting MBA HR Project Ideas
- Top 15 MBA Project Ideas
- 18 Exciting MBA Marketing Projects
- MBA Project Ideas: Consumer Behavior
- What is Brand Management?
- What is Holistic Marketing?
- What is Green Marketing?
- Intro to Organizational Behavior Model
- Tech Skills Every MBA Should Learn
- Most Demanding Short Term Courses MBA
- MBA Salary, Resume, and Skills
- MBA Salary in India
- HR Salary in India
- Investment Banker Salary India
- MBA Resume Samples
- Sample SOP for MBA
- Sample SOP for Internship
- 7 Ways MBA Helps Your Career
- Must-have Skills in Sales Career
- 8 Skills MBA Helps You Improve
- Top 20+ SAP FICO Interview Q&A
- MBA Specializations and Comparative Guides
- Why MBA After B.Tech? 5 Reasons
- How to Answer 'Why MBA After Engineering?'
- Why MBA in Finance
- MBA After BSc: 10 Reasons
- Which MBA Specialization to choose?
- Top 10 MBA Specializations
- MBA vs Masters: Which to Choose?
- Benefits of MBA After CA
- 5 Steps to Management Consultant
- 37 Must-Read HR Interview Q&A
- Fundamentals and Theories of Management
- What is Management? Objectives & Functions
- Nature and Scope of Management
- Decision Making in Management
- Management Process: Definition & Functions
- Importance of Management
- What are Motivation Theories?
- Tools of Financial Statement Analysis
- Negotiation Skills: Definition & Benefits
- Career Development in HRM
- Top 20 Must-Have HRM Policies
- Project and Supply Chain Management
- Top 20 Project Management Case Studies
- 10 Innovative Supply Chain Projects
- Latest Management Project Topics
- 10 Project Management Project Ideas
- 6 Types of Supply Chain Models
- Top 10 Advantages of SCM
- Top 10 Supply Chain Books
- What is Project Description?
- Top 10 Project Management Companies
- Best Project Management Courses Online
- Salaries and Career Paths in Management
- Project Manager Salary in India
- Average Product Manager Salary India
- Supply Chain Management Salary India
- Salary After BBA in India
- PGDM Salary in India
- Top 7 Career Options in Management
- CSPO Certification Cost
- Why Choose Product Management?
- Product Management in Pharma
- Product Design in Operations Management
- Industry-Specific Management and Case Studies
- Amazon Business Case Study
- Service Delivery Manager Job
- Product Management Examples
- Product Management in Automobiles
- Product Management in Banking
- Sample SOP for Business Management
- Video Game Design Components
- Top 5 Business Courses India
- Free Management Online Course
- SCM Interview Q&A
- Fundamentals and Types of Law
- Acceptance in Contract Law
- Offer in Contract Law
- 9 Types of Evidence
- Types of Law in India
- Introduction to Contract Law
- Negotiable Instrument Act
- Corporate Tax Basics
- Intellectual Property Law
- Workmen Compensation Explained
- Lawyer vs Advocate Difference
- Law Education and Courses
- LLM Subjects & Syllabus
- Corporate Law Subjects
- LLM Course Duration
- Top 10 Online LLM Courses
- Online LLM Degree
- Step-by-Step Guide to Studying Law
- Top 5 Law Books to Read
- Why Legal Studies?
- Pursuing a Career in Law
- How to Become Lawyer in India
- Career Options and Salaries in Law
- Career Options in Law India
- Corporate Lawyer Salary India
- How To Become a Corporate Lawyer
- Career in Law: Starting, Salary
- Career Opportunities: Corporate Law
- Business Lawyer: Role & Salary Info
- Average Lawyer Salary India
- Top Career Options for Lawyers
- Types of Lawyers in India
- Steps to Become SC Lawyer in India
- Tutorials
- C Tutorials
- Recursion in C: Fibonacci Series
- Checking String Palindromes in C
- Prime Number Program in C
- Implementing Square Root in C
- Matrix Multiplication in C
- Understanding Double Data Type
- Factorial of a Number in C
- Structure of a C Program
- Building a Calculator Program in C
- Compiling C Programs on Linux
- Java Tutorials
- Handling String Input in Java
- Determining Even and Odd Numbers
- Prime Number Checker
- Sorting a String
- User-Defined Exceptions
- Understanding the Thread Life Cycle
- Swapping Two Numbers
- Using Final Classes
- Area of a Triangle
- Skills
- Software Engineering
- JavaScript
- Data Structure
- React.js
- Core Java
- Node.js
- Blockchain
- SQL
- Full stack development
- Devops
- NFT
- BigData
- Cyber Security
- Cloud Computing
- Database Design with MySQL
- Cryptocurrency
- Python
- Digital Marketings
- Advertising
- Influencer Marketing
- Search Engine Optimization
- Performance Marketing
- Search Engine Marketing
- Email Marketing
- Content Marketing
- Social Media Marketing
- Display Advertising
- Marketing Analytics
- Web Analytics
- Affiliate Marketing
- MBA
- MBA in Finance
- MBA in HR
- MBA in Marketing
- MBA in Business Analytics
- MBA in Operations Management
- MBA in International Business
- MBA in Information Technology
- MBA in Healthcare Management
- MBA In General Management
- MBA in Agriculture
- MBA in Supply Chain Management
- MBA in Entrepreneurship
- MBA in Project Management
- Management Program
- Consumer Behaviour
- Supply Chain Management
- Financial Analytics
- Introduction to Fintech
- Introduction to HR Analytics
- Fundamentals of Communication
- Art of Effective Communication
- Introduction to Research Methodology
- Mastering Sales Technique
- Business Communication
- Fundamentals of Journalism
- Economics Masterclass
- Free Courses
Selenium Projects with Eclipse Samples in 2024
Updated on 11 July, 2024
44.37K+ views
• 10 min read
Table of Contents
Selenium is among the prominent technologies in the automation section of web testing. By using Selenium properly, you can make your testing process quite efficient and complete multiple tasks within a small amount of time.
That’s why learning Selenium has gained a lot of significance. In this article, you’ll learn how to work on a Selenium project with Eclipse, another popular technology for Java-based projects.
First, I’ll discuss the basics of these technologies. Then we’ll look at how you can start a Selenium project by using Eclipse. We have also shared a few sample selenium projects which you can take inspiration from. Let’s get started.
Check out our free courses to get an edge over the competition.
Explore Our Software Development Free Courses
What is Selenium?
Selenium is a portable framework and a popular tool for web app testing. It is compatible with multiple programming languages such as Python, C#, and Java. You can use those languages to perform various tasks with Selenium, such as creating a test script. Still, most users prefer to use Java with this framework because it’s more user-friendly than the rest.
Selenium is not a single software application. It is a suite of various tools that you can use to perform different sorts of testing.
Check out upGrad’s Full Stack Development Bootcamp
Selenium has the following tools in its suite:
- Selenium IDE (Integrated Development Environment)
- Selenium WebDriver
- Selenium Client API
- Selenium Remote Control (Deprecated)
- Selenium Grid
Jason Huggins created Selenium in the year 2004. He wanted to automate the repetitive manual testing process, so he made a JavaScript program. That same program became the Selenium Core. Apart from Jason, many other developers contributed to creating the Selenium suite.
Check out upGrad’s Advanced Certification in DevOps
Explore Our Software Development Free Courses
Why it’s called Selenium?
Selenium derives its name from a joke. At the time of its development, there was another major automated testing framework named Mercury Interactive. Jason jokingly suggested the Selenium to his friends because Selenium is a popular antidote for Mercury poisoning. His friends accepted the suggestion and gave it the name it has now.
Features of Selenium
Selenium has many features; the most prominent ones are the following:
- Selenium is compatible with almost all major browsers of the industry, including Chrome, Opera, Safari, etc.
- This suite has a specific group of commands which are called Selenese. They hold the sequence of every Selenium command.
- You can locate elements on a web page through Selenium’s element locators.
- You cannot use Selenium to test desktop applications or mobile apps. You can only use it for web app testing.
Read: Selenium Project Ideas
What is Maven?
Maven is an automation tool that developers mostly use for Java projects. Apart from Java, you can use it with several other programming languages such as C#, Scala, Ruby, etc. It’s a product of the Apache Software Foundation, so it is an open-source tool.
Maven makes the build process much more straightforward and provides you with a uniform build system. It ensures that Java developers follow the best development sample selenium projects for practice while working on Java projects. It entered the industry in the year 2002, and since then, it has become one of the most significant Apache projects.
Maven derives its name from the Yiddish word ‘maven,’ which means “accumulator of knowledge.”
Features of Maven
- Maven ensures consistency among various projects
- It simplifies project set up by providing the boilerplate for modules or projects
- Can work with several projects at once
- Maven can build any quantity of projects into its specific output types such as a WAR or JAR without requiring scripting in many cases
- It is based on the POM (project object model)
Now that we have discussed Selenium and Maven let’s understand the Eclipse IDE. Having a working knowledge of these three is crucial if you want to work on a Selenium project with Eclipse.
upGrad’s Exclusive Software and Tech Webinar for you –
SAAS Business – What is So Different?
What is the Eclipse IDE?
Eclipse is an IDE (integrated development environment) that helps developers work with Selenium and related technologies. You can use Eclipse to develop applications in C++, Ruby, Python, C, Perl, Java, etc.
Features of the Eclipse IDE
- It is an open-source tool, which means you can use it for free.
- The foundational platform of the Eclipse IDE has multiple plugins and can be extended with more plugins.
- You can convert Eclipse into an IDE for any programming language by using its respective plugin.
- The JDT (Java Development Tools) project gives a plugin to use Eclipse as a Java IDE. Similarly, PyDev is a plugin that allows you to use Eclipse as a Python IDE.
- You can use the Eclipse platform and its plugins to create IDEs, client applications, etc.
How to Create a Selenium Project with Eclipse IDE
In this section of our article, we’ll look at how you can create a Selenium project with Eclipse. It’s the first step of working on a sample selenium project in eclipse, and many beginners struggle with it.
You’d need to have Maven and TestNG installed in your system before you can create a Selenium project through Eclipse. Ensure that you install them (Maven and TestNG) before you begin this process.
Step #1:
Open Eclipse and right-click on the Package Explorer section. You’d see a menu pop-up. Select the ‘New’ button, which will open another menu to select the “Other…” option.
Step #2:
When you’d click the “Other…” button, it would open a new window. Select the Maven Project and then click on the ‘Next’ button.
Step #3:
A new window will appear now. Here, you have to tick the ‘Create a simple project (skip archetype selection)” box. After that, select the “Next” button.
Step #4:
In this section, you’d have to enter the Group Id and the Artifact Id. They both are vital for the naming of your project. The Group Id will help you identify your project across all the other ones. It must follow the package name rules. This means it should start with a reverse domain name you control. Maven doesn’t enforce this naming rule; however, due to the tool’s vast popularity, it has become a common practice to follow this rule. You can make multiple subgroups with a Group Id as well.
The Artifact Id is the name of your jar without a version. If you are its creator, you can choose any name you want as long as you don’t use any strange symbols and only use lowercase letters.
Keep the above points in mind while entering the Group Id and Artifact Id for your project. Once you have entered these details, click on the “Finish” button.
Step #5:
Let’s add the necessary dependencies to the POM file for our project. Head to the pom.xml file and select the ‘pom.xml’ tab in Eclipse. Now, add the dependencies related to TestNG and Selenium WebDriver.
Step #6:
In this step, get a testng.xml file by creating a TestNG class. Copy the following code in this file:
package tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
public class NewTest {
public WebDriver driver;
@Test
public void openMyBlog() {
driver.get("https://www.softwaretestingmaterial.com/");
}
@BeforeClass
public void beforeClass() {
System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\Drivers\\geckodriver.exe");
driver = new FirefoxDriver();
}
@AfterClass
public void afterClass() {
driver.quit();
}
}
Step #7:
Now you can run your Selenium project with Eclipse by using the TestNG file.
Make sure that you understand the above tutorial before you move onto the next one. That’s because, in the following section, we’ll discuss a working of a Selenium Java project example that you can build by using Eclipse.
Also Read: Selenium Developer Salary in India
Get Software Development Course from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs, or Masters Programs to fast-track your career.
Selenium Project with Eclipse: An Example
Here, we have shared the code for a flight-booking solution based on Selenium. The software selects the arrival and departure locations for the flight along with the date of the same. This tool performs these tasks on the MakeMyTrip website.
You can take inspiration from these sample selenium projects to create a similar Selenium project with Eclipse yourself. If you haven’t worked on a Selenium project before, we suggest working on a smaller version of this project first.
For example, you can create a program that selects the arrival and departure locations only. On the other hand, if you want to expand on this project, you can add more functionalities.
The Browser
package browser;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class BrowserSelection
{
static WebDriver driver;
public static WebDriver UsingChrome()
{
System.setProperty("webdriver.chrome.driver", "E:\\SeleniumLibs\\\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
return driver;
}
}
In-Demand Software Development Skills
The Code
package makemytrip;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import browser.BrowserSelection;
public class MakeMyTripProject
{
WebDriver driver;
@BeforeMethod
public void OpenBrowser()
{
driver = BrowserSelection.UsingChrome();
}
@Test
public void TripDetails() throws InterruptedException, AWTException
{
driver.get("https://www.makemytrip.com/");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Thread.sleep(5000);
try
{
/*String frameStatus = driver.findElement(By.id("webklipper-publisher-widget-container-notification-frame")).getTagName();
System.out.println(frameStatus);
driver.switchTo().frame("notification-frame-31764456");
driver.findElement(By.xpath(".//*[@id='webklipper-publisher-widget-container-notification-close-div']/i")).click();
driver.switchTo().defaultContent();
Thread.sleep(3000); */
driver.findElement(By.xpath("//input[@id='hp-widget__sfrom']")).click();
driver.findElement(By.xpath("//input[@id='hp-widget__sfrom']")).clear();
//driver.findElement(By.xpath("//input[@id='hp-widget__sfrom']")).sendKeys("Goa");
Thread.sleep(2000);
List<WebElement> fromCities = driver.findElements(By.xpath("//ul[@id='ui-id-1']/li/div/p/span[1]"));
System.out.println(fromCities.size()+"\n");
for(int i=0;i<fromCities.size();i++)
{
WebElement element=fromCities.get(i);
System.out.println(element.getAttribute("innerHTML"));
}
//driver.findElement(By.xpath("//ul[@id='ui-id-1']/li/div/p/span")).click();
driver.findElement(By.xpath("//li[contains(@aria-label,'Top Cities : Goa, India ')]/div/p/span[1]")).click();
driver.findElement(By.xpath("//input[@id='hp-widget__sTo']")).click();
driver.findElement(By.xpath("//input[@id='hp-widget__sTo']")).clear();
//driver.findElement(By.xpath("//input[@id='hp-widget__sTo']")).sendKeys("Mumbai");
Thread.sleep(2000);
List<WebElement> toCities = driver.findElements(By.xpath("//ul[@id='ui-id-2']/li/div/p/span[1]"));
System.out.println(toCities.size()+"\n");
for(int i=0;i<toCities.size();i++)
{
WebElement element=toCities.get(i);
System.out.println(element.getAttribute("innerHTML"));
}
//driver.findElement(By.xpath("//ul[@id='ui-id-2']/li/div/p/span")).click();
driver.findElement(By.xpath("//ul[@id='ui-id-2']/li[3]/div/p/span[1]")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@id='hp-widget__depart']")).click();
Thread.sleep(2000);
String date = "10-OCTOBER-2018";
String splitter[] = date.split("-");
String month_year = splitter[1];
String day = splitter[0];
System.out.println(month_year);
System.out.println(day);
selectDate(month_year,day);
Thread.sleep(3000);
driver.findElement(By.xpath("//button[@id='searchBtn']")).click();
Thread.sleep(5000);
Thread.sleep(2000);
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0,3000)");
/*Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_PAGE_DOWN);
robot.keyRelease(KeyEvent.VK_PAGE_DOWN);*/
Thread.sleep(5000);
driver.findElement(By.xpath("//div[@id='aln_AI_dep']/span[3]")).click();
Thread.sleep(5000);
List<WebElement> flights = driver.findElements(By.xpath("//div[@class='top_first_part clearfix']/div/span/span[2]/span[1]"));
System.out.println("No. of Air India flight search results: ---"+flights.size());
}catch(WebDriverException e)
{
System.out.println("Exception is: ---"+e+"\n");
}
}
public void selectDate(String monthyear, String Selectday) throws InterruptedException
{
List<WebElement> elements = driver.findElements(By.xpath("//div[@class='ui-datepicker-title']/span[1]"));
for (int i=0; i<elements.size();i++)
{
System.out.println(elements.get(i).getText());
//Selecting the month
if(elements.get(i).getText().equals(monthyear))
{
//Selecting the date
List<WebElement> days = driver.findElements(By.xpath("//div[@class='ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-datepicker-multi ui-datepicker-multi-2']/div[2]/table/tbody/tr/td/a"));
for (WebElement d:days)
{
System.out.println(d.getText());
if(d.getText().equals(Selectday))
{
d.click();
Thread.sleep(10000);
return;
}
}
}
}
driver.findElement(By.xpath("//div[@class='ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-datepicker-multi ui-datepicker-multi-2']/div[2]/div/a/span")).click();
selectDate(monthyear,Selectday);
}
@AfterMethod
public void CloseBrowser()
{
driver.quit();
}
}
Sample Selenium Project with Source Code: Selenium Test Automation With Eclipse
Read: 5 Interesting Selenium Project Ideas & Topics For Beginners
Explore our Popular Software Engineering Courses
Learn to Create a Selenium Project with Eclipse and More
Selenium is quite a vital technology. Learning about it will help you become a proficient software testing professional. Here are some additional resources on Selenium and Maven for your further reading:
If you want to learn more about Selenium or software testing, we recommend taking a computer science course. You’ll get to know from industry experts through interactive quizzes, problems, and projects. Exploring sample selenium projects can be an excellent way to enhance your practical understanding.
We hope you found this guide useful. If you have any questions regarding this article or Selenium, please ask us through the comment section below. We’d love to hear from you.
If you’re interested to learn more about full-stack software development, check out upGrad & IIIT-B’s Executive PG Program in Full-stack Software Development which is designed for working professionals and offers 500+ hours of rigorous training, 9+ projects, and assignments, IIIT-B Alumni status, practical hands-on capstone projects & job assistance with top firms.
Frequently Asked Questions (FAQs)
1. Does Selenium provide good career opportunities?
Indulging in this open-source and easy-to-use technology definitely holds a prosperous career since there will be a constant demand for software in most firms in the near future. Selenium is used widely for testing by several MNCs, including Facebook, Microsoft, Cognizant, HP, Accenture, etc. These companies hire Selenium Testers that are well-versed in the language and have received Selenium certification. Thus, Selenium provides decent career opportunities and can be a great career choice.
2. Is it hard to learn Selenium?
Learning Selenium is not that difficult, but it needs solid discipline and a brilliant road map to master it quickly. If you have some experience in programming, Selenium would not be very hard to grasp. To study automated testing with Selenium in an organized and effective manner, one should focus on learning 4 things: Java, Selenium Webdriver, TestNG, and Frameworks. Thus, you can learn Selenium with good strategy and consistency along with a clear plan; it is no rocket science.
3. How much does a Selenium tester earn in India?
A selenium tester's income is determined by the firm he works for, the number of years he has worked in the field, and his skill set. In the automated testing industry, skill sets and experience are the most important since they determine the difference in work wage between individuals, even within the same organization. The income of a Selenium Automation Tester in India ranges from 4.0 lakhs to 15.1 lakhs per year, with an average yearly salary of 7.4 lakhs.
RELATED PROGRAMS