SlideShare a Scribd company logo
Setup IntelliJ and Seleniumwebdriver
Download the IntelliJ Community edition from
https://www.jetbrains.com/idea/download/
Download Selenium Server JAR
http://www.seleniumhq.org/download/
(named as Selenium Standalone Server)
Create New Project
● Click on new project
● Select Java in left pane and select java sdk then click next button twice
● Enter project name and set your preferred location (By default it has one location keep it
if you don’t have any preferences)
● Click on next
Adding SeleniumServer Libraryto the project
Click on File-> Project Structure…
On the project structure window - left side select Libraries
Then click on the + symbol on top left side -> Select java -> select the selenium driver JAR
which you have downloaded -> OK -> OK.
Start with test framework
Create package
Right click on src -> New -> Package
Enter package name(Example: app) -> click OK
Create new class
Right click on Package name -> New -> Java Class
Enter Name <ClassName> (Ex: Browser)
Create a test source file
Right click on ProjectName -> New -> Directory
Enter Name as test
Right click on the test directory -> Mark Directory As -> Test Sources Root
Right click on test -> New -> Package
Enter package name same as you did in src folder
Create a test class
Right click on Package name -> New -> Java Class
Enter Name <ClassNameTest> (Ex: BrowserTest)
Execute the scenario from IntelliJ
Right click on Class file -> Select Run ‘<ClassName>.main()’
(OR)
Or click on Run from the file menu -> Run ‘<ClassName>’
Test Scenarios
Browser Initialization
Steps
Open Firefox Browser
Open ‘https://www.facebook.com’
Close Browser
Identifying an element
Steps
Open ‘https://www.facebook.com’
Identify ‘username’ text box
Close browser
Fill the data in the username and password
Steps
Open ‘https://www.facebook.com’
Identify ‘username’ text box and fill username
Identify ‘password’ text box and fill password
Identify ‘Login’ button and click
Close browser
Assert Failed login to facebook using JUnit
Steps
Open ‘https://www.facebook.com’
Enter Invalid ‘username’ and ‘password’
Login
Assert login fails
Close browser
Assert Successful login to facebook using JUnit
Steps
Open ‘https://www.facebook.com’
Enter valid ‘username’ and ‘password’
Login
Verify user profile name
Assert login is successful.
Close browser
Separate tests from function:
Added @After Tag
Find element by XPATH:

More Related Content

PPTX
Automation test
PDF
Selenium IDE features
PPT
Aula De Impresso Francisca
PDF
Basics of java
PDF
Algebra 9-klas-malovanij
PDF
Object oriented principles
PDF
Refresh software testing concepts
PDF
Introduction to automation testing
Automation test
Selenium IDE features
Aula De Impresso Francisca
Basics of java
Algebra 9-klas-malovanij
Object oriented principles
Refresh software testing concepts
Introduction to automation testing

Similar to Selenium Basics (20)

DOCX
Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
DOC
About Selenium Webdriver
PDF
Selenium tools-installation
PDF
Selenium tools-installation
DOCX
Automation Frame works Instruction Sheet
DOCX
Selenium guideline
PDF
Installation
DOCX
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
DOCX
SELENIUM SCRIPTS FOR DASHBOARD UI
PDF
Creating selenium remote control tests
ODP
Developing Java SWT Applications - A Starter
PDF
Java netbeans
PDF
InstallationGuide-JavaEclipseAndMaven_v2.pdf
DOCX
To run java program in eclipse
PDF
J creator4 5
DOC
Gwt portlet
DOCX
Project3build.xml Builds, tests, and runs the project .docx
PPTX
Selenium Testing
PPT
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
PDF
Selenium with testng and eclipse ide
Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
About Selenium Webdriver
Selenium tools-installation
Selenium tools-installation
Automation Frame works Instruction Sheet
Selenium guideline
Installation
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
SELENIUM SCRIPTS FOR DASHBOARD UI
Creating selenium remote control tests
Developing Java SWT Applications - A Starter
Java netbeans
InstallationGuide-JavaEclipseAndMaven_v2.pdf
To run java program in eclipse
J creator4 5
Gwt portlet
Project3build.xml Builds, tests, and runs the project .docx
Selenium Testing
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium with testng and eclipse ide
Ad

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Tartificialntelligence_presentation.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
1. Introduction to Computer Programming.pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Getting Started with Data Integration: FME Form 101
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Programs and apps: productivity, graphics, security and other tools
Tartificialntelligence_presentation.pptx
Encapsulation theory and applications.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Assigned Numbers - 2025 - Bluetooth® Document
1. Introduction to Computer Programming.pptx
Heart disease approach using modified random forest and particle swarm optimi...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Encapsulation_ Review paper, used for researhc scholars
A comparative study of natural language inference in Swahili using monolingua...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks
Network Security Unit 5.pdf for BCA BBA.
Getting Started with Data Integration: FME Form 101
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Ad

Selenium Basics

  • 1. Setup IntelliJ and Seleniumwebdriver Download the IntelliJ Community edition from https://www.jetbrains.com/idea/download/ Download Selenium Server JAR http://www.seleniumhq.org/download/ (named as Selenium Standalone Server) Create New Project ● Click on new project ● Select Java in left pane and select java sdk then click next button twice ● Enter project name and set your preferred location (By default it has one location keep it if you don’t have any preferences) ● Click on next Adding SeleniumServer Libraryto the project Click on File-> Project Structure… On the project structure window - left side select Libraries Then click on the + symbol on top left side -> Select java -> select the selenium driver JAR which you have downloaded -> OK -> OK. Start with test framework
  • 2. Create package Right click on src -> New -> Package Enter package name(Example: app) -> click OK Create new class Right click on Package name -> New -> Java Class Enter Name <ClassName> (Ex: Browser) Create a test source file Right click on ProjectName -> New -> Directory Enter Name as test Right click on the test directory -> Mark Directory As -> Test Sources Root Right click on test -> New -> Package Enter package name same as you did in src folder Create a test class Right click on Package name -> New -> Java Class Enter Name <ClassNameTest> (Ex: BrowserTest) Execute the scenario from IntelliJ Right click on Class file -> Select Run ‘<ClassName>.main()’ (OR) Or click on Run from the file menu -> Run ‘<ClassName>’ Test Scenarios Browser Initialization Steps Open Firefox Browser Open ‘https://www.facebook.com’ Close Browser Identifying an element Steps Open ‘https://www.facebook.com’
  • 3. Identify ‘username’ text box Close browser Fill the data in the username and password Steps Open ‘https://www.facebook.com’ Identify ‘username’ text box and fill username Identify ‘password’ text box and fill password Identify ‘Login’ button and click Close browser Assert Failed login to facebook using JUnit Steps Open ‘https://www.facebook.com’ Enter Invalid ‘username’ and ‘password’ Login
  • 4. Assert login fails Close browser Assert Successful login to facebook using JUnit Steps Open ‘https://www.facebook.com’ Enter valid ‘username’ and ‘password’ Login Verify user profile name Assert login is successful. Close browser Separate tests from function: