SlideShare a Scribd company logo
1 of 6
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

Similar to Selenium Basics

Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup ComputerTrainingsOnline
 
Selenium tools-installation
Selenium tools-installationSelenium tools-installation
Selenium tools-installationITeLearn
 
Selenium tools-installation
Selenium tools-installationSelenium tools-installation
Selenium tools-installationIT eLearn
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction SheetvodQA
 
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Rashedul Islam
 
SELENIUM SCRIPTS FOR DASHBOARD UI
SELENIUM SCRIPTS FOR DASHBOARD UISELENIUM SCRIPTS FOR DASHBOARD UI
SELENIUM SCRIPTS FOR DASHBOARD UIManasa Dilipkumar
 
Creating selenium remote control tests
Creating selenium remote control testsCreating selenium remote control tests
Creating selenium remote control testsDang Nguyen
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Startervcaselli
 
To run java program in eclipse
To run java program in eclipseTo run java program in eclipse
To run java program in eclipseAshish Arun
 
Project3build.xml Builds, tests, and runs the project .docx
Project3build.xml      Builds, tests, and runs the project .docxProject3build.xml      Builds, tests, and runs the project .docx
Project3build.xml Builds, tests, and runs the project .docxwoodruffeloisa
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Appschrisb206 chrisb206
 
Selenium with testng and eclipse ide
Selenium with testng and eclipse ideSelenium with testng and eclipse ide
Selenium with testng and eclipse ideTestertester Jaipur
 

Similar to Selenium Basics (20)

Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
Selenium webdriver Setup | Selenium Webdriver with Java and Eclipse Setup
 
About Selenium Webdriver
About Selenium WebdriverAbout Selenium Webdriver
About Selenium Webdriver
 
Selenium tools-installation
Selenium tools-installationSelenium tools-installation
Selenium tools-installation
 
Selenium tools-installation
Selenium tools-installationSelenium tools-installation
Selenium tools-installation
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
 
Selenium guideline
Selenium guidelineSelenium guideline
Selenium guideline
 
Installation
InstallationInstallation
Installation
 
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
 
SELENIUM SCRIPTS FOR DASHBOARD UI
SELENIUM SCRIPTS FOR DASHBOARD UISELENIUM SCRIPTS FOR DASHBOARD UI
SELENIUM SCRIPTS FOR DASHBOARD UI
 
Creating selenium remote control tests
Creating selenium remote control testsCreating selenium remote control tests
Creating selenium remote control tests
 
Developing Java SWT Applications - A Starter
Developing Java SWT Applications - A StarterDeveloping Java SWT Applications - A Starter
Developing Java SWT Applications - A Starter
 
Java netbeans
Java netbeansJava netbeans
Java netbeans
 
To run java program in eclipse
To run java program in eclipseTo run java program in eclipse
To run java program in eclipse
 
J creator4 5
J creator4 5J creator4 5
J creator4 5
 
Gwt portlet
Gwt portletGwt portlet
Gwt portlet
 
Project3build.xml Builds, tests, and runs the project .docx
Project3build.xml      Builds, tests, and runs the project .docxProject3build.xml      Builds, tests, and runs the project .docx
Project3build.xml Builds, tests, and runs the project .docx
 
Selenium Testing
Selenium Testing Selenium Testing
Selenium Testing
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Selenium with testng and eclipse ide
Selenium with testng and eclipse ideSelenium with testng and eclipse ide
Selenium with testng and eclipse ide
 
Selenium with java
Selenium with javaSelenium with java
Selenium with java
 

Recently uploaded

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 

Recently uploaded (20)

Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 

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: