SlideShare a Scribd company logo
1 of 15
SELENIUM
Automation Testing
Introduction to Selenium
Who named Automation testing tool as Selenium?
● Jason Huggins and team from ThoughtWorks Inc. developed the testing tool
in 2004.
● Huggins joked about competitor HP mercury tools saying it cures mercury
poisoning by taking Selenium supplements.
● Hence, the name!
How to start - Windows 7, 8 and XP
Webdriver-To control Browser
webDriver driver=new FirefoxDriver();
WebElement-to work with the elements of the page=
WebElement element=driver.findelement(By.id(“id”));
Methods:- “findElement” is a method in webdriver interface which is used to identify required element in the
application.This method takes as an object as an argument of type “By”.
Locators:-Webdriver supports 8 locators to identify the element.
Types of Locators:- 1.By.id(arg)
2.By.name(string)
3.By.xpath(String xpath expression)
4.By.cssSelector(String selector)
5.By.tagName(String name)
6.By.linkText(string linkText)
7.By.partiallinkText(string linkText)
8.By.className(String className)
What is Xpath ?
Xpath=//tagname[@attribute=’value’]
Select Class
Types :- 1.SelectByVisibletext()
2.SelectByIndex()
3.SelectbyValue()
4.deselectAll()
5.isMultiple()
6.getOption()
7.getFirstSelectedOption()
8.getAllSelectedOption()
Waits
Types:- 1.Normal Wait
thread.sleep(20,000)
2.implicitly wait
driver.manage().timeouts().implicitlywait(10,TimeUnit.SECONDS)
3.Explicitly wait
WebdriverWait=new WebDriverWait(driver.20)
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath( "String Xpath
Expression")));
Action Class
Action class used to perform user interaction operation like mousehover, right-click , double click & keyboard
operation.
Step-1 : Find a element where we need to perform mouseover operation.
WebElement wb = driver.findelement(By.xpath(“….”));
Step-2: Create an object to Action class.
Actions act = new Actions(driver);
Step-3: Use Mouse over operation :
act.moveToelement(wb).perform();
Window Handling
Step-1: Click the button which opens child window.
WebElement wb = driver.findelement(By.xpath(“….”));
Step-2: Get all the current active window Id’s.
Set<String> set = driver.getWindowHandles();
Step-3: Using iterator capture the Window Id’s from SET
Iterator<String> itr = set.iterator();
String ParentID = itr.next();
String ChildID=itr.next();
Step-4: Pass driver control to child window.
driver.switchTo().window(childID);
Screenshots
Step-1: EventFiringWebDriver dDriver = new EventFiringWebDriver(driver);
Step-2: getScreenshotAs() method returns imagefile.
File SrcImg = dDriver.getScreenshotAs(OutputType.File)
File dstnImag = new File(“c:userscreenshottest.png”)
Step-3: Get a help Apache poi, to store image in loca system.
FileUtils.copyFile(srcImg , dstimg)
How To DownLoad a file from a Browser
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk"Mime type of the file”);
How To Upload a file in a Browser
First we need to install AutoIt
WinActive(“$”)
fileupload(give the path of the file you want to upload)
ControlSetText(fileupload.$,edit1)
ControlClick(fileupload,$,Button1)
Save it .Au3 format
Then in webdriver write “Runtime.getRuntime().exec("AutoIt .exe filepath");”
Reading data from EXCEL
Step-1: Specify the file path on which you are planning to interact.
FileInputStream fis = new FileInputStream (Filepath);
Step-2: Open WorkBook in Read Mode.
Workbook wb = WorkbookFactory.create(fis);
Step-3: Get the Control of the “Data” Sheet.
Sheet sh = wb.getSheet(“Data”);
Step-4: Get the Control of the 1st Row.
Row row = sh.getRow(1);
Step-5: Read the 2nd cell value from 1st Row.
String userName = row.getCell(2).getStringCellValue();
String Password = row.getCell(3).getStringCellValue();
Test-NG
TestNG is a unit testing framework tool for Core java & .Net languages.
Test-NG is implemented as a plugin for eclipse.
Annotations in TestNG
@Test
@BeforeMethod
@AfterMethod
@BeforeClass
@AfterClass
@BeforeSuite
@AfterSuite
THANK YOU

More Related Content

What's hot

( 15 ) Office 2007 Create A Membership Database
( 15 ) Office 2007   Create A Membership Database( 15 ) Office 2007   Create A Membership Database
( 15 ) Office 2007 Create A Membership Database
LiquidHub
 
Implement Search Screen Using Knockoutjs
Implement Search Screen Using KnockoutjsImplement Search Screen Using Knockoutjs
Implement Search Screen Using Knockoutjs
Neeraj Kaushik
 
Remote code-with-expression-language-injection
Remote code-with-expression-language-injectionRemote code-with-expression-language-injection
Remote code-with-expression-language-injection
Mickey Jack
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
drewz lin
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New Evolution
Allan Huang
 

What's hot (19)

How to identify and prevent SQL injection
How to identify and prevent SQL injection  How to identify and prevent SQL injection
How to identify and prevent SQL injection
 
Examplecode
ExamplecodeExamplecode
Examplecode
 
What's New in Django 1.6
What's New in Django 1.6What's New in Django 1.6
What's New in Django 1.6
 
( 15 ) Office 2007 Create A Membership Database
( 15 ) Office 2007   Create A Membership Database( 15 ) Office 2007   Create A Membership Database
( 15 ) Office 2007 Create A Membership Database
 
Implement Search Screen Using Knockoutjs
Implement Search Screen Using KnockoutjsImplement Search Screen Using Knockoutjs
Implement Search Screen Using Knockoutjs
 
Ext java-editor
Ext java-editorExt java-editor
Ext java-editor
 
Accessibility Testing using Axe
Accessibility Testing using AxeAccessibility Testing using Axe
Accessibility Testing using Axe
 
Remote code-with-expression-language-injection
Remote code-with-expression-language-injectionRemote code-with-expression-language-injection
Remote code-with-expression-language-injection
 
10 Rules for Safer Code
10 Rules for Safer Code10 Rules for Safer Code
10 Rules for Safer Code
 
Multiple File Upload Control
Multiple File Upload ControlMultiple File Upload Control
Multiple File Upload Control
 
Wicket Security Presentation
Wicket Security PresentationWicket Security Presentation
Wicket Security Presentation
 
ERRest
ERRestERRest
ERRest
 
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
Dicoding Developer Coaching #19: Android | Menyimpan Database Secara Local di...
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
 
Introduction to jQuery - The basics
Introduction to jQuery - The basicsIntroduction to jQuery - The basics
Introduction to jQuery - The basics
 
Unit testing
Unit testingUnit testing
Unit testing
 
Dvwa low level
Dvwa low levelDvwa low level
Dvwa low level
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New Evolution
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 

Viewers also liked

Viewers also liked (8)

An introduction to Apache Cordova
An introduction to Apache CordovaAn introduction to Apache Cordova
An introduction to Apache Cordova
 
RESTful Web services in Drupal 8
RESTful Web services in Drupal 8RESTful Web services in Drupal 8
RESTful Web services in Drupal 8
 
Features module in drupal 8
Features module in drupal 8Features module in drupal 8
Features module in drupal 8
 
How to Schedule Automated Tasks in Drupal with Cron?
How to Schedule Automated Tasks in Drupal with Cron?How to Schedule Automated Tasks in Drupal with Cron?
How to Schedule Automated Tasks in Drupal with Cron?
 
Why JSON API?
Why JSON API?Why JSON API?
Why JSON API?
 
Drupal coding standards and best practices
Drupal coding standards and best practicesDrupal coding standards and best practices
Drupal coding standards and best practices
 
Token module in drupal 8
Token module in drupal 8Token module in drupal 8
Token module in drupal 8
 
Automation testing for beginners on Selenium
Automation testing for beginners on SeleniumAutomation testing for beginners on Selenium
Automation testing for beginners on Selenium
 

Similar to How to execute Automation Testing using Selenium

Scraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumScraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & Selenium
Roger Barnes
 
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptxTop 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
AnanthReddy38
 
2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug
Philip Schlesinger
 
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
 

Similar to How to execute Automation Testing using Selenium (20)

Web driver training
Web driver trainingWeb driver training
Web driver training
 
Complete_QA_Automation_Guide__1696637878.pdf
Complete_QA_Automation_Guide__1696637878.pdfComplete_QA_Automation_Guide__1696637878.pdf
Complete_QA_Automation_Guide__1696637878.pdf
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdfTop 15 Selenium WebDriver Interview Questions and Answers.pdf
Top 15 Selenium WebDriver Interview Questions and Answers.pdf
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Selenium interview questions and answers
Selenium interview questions and answersSelenium interview questions and answers
Selenium interview questions and answers
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Scraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & SeleniumScraping recalcitrant web sites with Python & Selenium
Scraping recalcitrant web sites with Python & Selenium
 
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptxTop 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
Automation Testing
Automation TestingAutomation Testing
Automation Testing
 
2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjug
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Latest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdfLatest Selenium Interview Questions And Answers.pdf
Latest Selenium Interview Questions And Answers.pdf
 
2. file internal memory
2. file internal memory2. file internal memory
2. file internal memory
 
GDG İstanbul Şubat Etkinliği - Sunum
GDG İstanbul Şubat Etkinliği - SunumGDG İstanbul Şubat Etkinliği - Sunum
GDG İstanbul Şubat Etkinliği - Sunum
 
Selenium WebDriver with Java
Selenium WebDriver with JavaSelenium WebDriver with Java
Selenium WebDriver with Java
 
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...
 

More from valuebound

How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
valuebound
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
valuebound
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
valuebound
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
valuebound
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
valuebound
 

More from valuebound (20)

Scaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic WebsitesScaling Drupal for High Traffic Websites
Scaling Drupal for High Traffic Websites
 
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdfDrupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
Drupal 7 to Drupal 10 Migration A Fintech Strategic Blueprint (1).pdf
 
How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.How to Use DDEV to Streamline Your Drupal Development Process.
How to Use DDEV to Streamline Your Drupal Development Process.
 
How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound How to Use AWS to Automate Your IT Operation| Valuebound
How to Use AWS to Automate Your IT Operation| Valuebound
 
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js AppsHow to Use Firebase to Send Push Notifications to React Native and Node.js Apps
How to Use Firebase to Send Push Notifications to React Native and Node.js Apps
 
Mastering Drupal Theming
Mastering Drupal ThemingMastering Drupal Theming
Mastering Drupal Theming
 
The Benefits of Cloud Engineering
The Benefits of Cloud EngineeringThe Benefits of Cloud Engineering
The Benefits of Cloud Engineering
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
The Future of Cloud Engineering: Emerging Trends and Technologies to Watch in...
 
Deep dive into ChatGPT
Deep dive into ChatGPTDeep dive into ChatGPT
Deep dive into ChatGPT
 
Content Creation Solution | Valuebound
Content Creation Solution | ValueboundContent Creation Solution | Valuebound
Content Creation Solution | Valuebound
 
Road ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projectsRoad ahead for Drupal 8 contributed projects
Road ahead for Drupal 8 contributed projects
 
Chatbot with RASA | Valuebound
Chatbot with RASA | ValueboundChatbot with RASA | Valuebound
Chatbot with RASA | Valuebound
 
Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization Drupal and Artificial Intelligence for Personalization
Drupal and Artificial Intelligence for Personalization
 
Drupal growth in last year | Valuebound
Drupal growth in last year | ValueboundDrupal growth in last year | Valuebound
Drupal growth in last year | Valuebound
 
BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"BE NEW TO THE WORLD "BRAVE FROM CHROME"
BE NEW TO THE WORLD "BRAVE FROM CHROME"
 
Event loop in browser
Event loop in browserEvent loop in browser
Event loop in browser
 
The Basics of MongoDB
The Basics of MongoDBThe Basics of MongoDB
The Basics of MongoDB
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
Dependency Injection in Drupal 8
Dependency Injection in Drupal 8Dependency Injection in Drupal 8
Dependency Injection in Drupal 8
 

Recently uploaded

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

How to execute Automation Testing using Selenium

  • 2. Introduction to Selenium Who named Automation testing tool as Selenium? ● Jason Huggins and team from ThoughtWorks Inc. developed the testing tool in 2004. ● Huggins joked about competitor HP mercury tools saying it cures mercury poisoning by taking Selenium supplements. ● Hence, the name!
  • 3. How to start - Windows 7, 8 and XP Webdriver-To control Browser webDriver driver=new FirefoxDriver(); WebElement-to work with the elements of the page= WebElement element=driver.findelement(By.id(“id”));
  • 4. Methods:- “findElement” is a method in webdriver interface which is used to identify required element in the application.This method takes as an object as an argument of type “By”. Locators:-Webdriver supports 8 locators to identify the element. Types of Locators:- 1.By.id(arg) 2.By.name(string) 3.By.xpath(String xpath expression) 4.By.cssSelector(String selector) 5.By.tagName(String name) 6.By.linkText(string linkText) 7.By.partiallinkText(string linkText) 8.By.className(String className)
  • 5. What is Xpath ? Xpath=//tagname[@attribute=’value’]
  • 6.
  • 7. Select Class Types :- 1.SelectByVisibletext() 2.SelectByIndex() 3.SelectbyValue() 4.deselectAll() 5.isMultiple() 6.getOption() 7.getFirstSelectedOption() 8.getAllSelectedOption()
  • 8. Waits Types:- 1.Normal Wait thread.sleep(20,000) 2.implicitly wait driver.manage().timeouts().implicitlywait(10,TimeUnit.SECONDS) 3.Explicitly wait WebdriverWait=new WebDriverWait(driver.20) wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath( "String Xpath Expression")));
  • 9. Action Class Action class used to perform user interaction operation like mousehover, right-click , double click & keyboard operation. Step-1 : Find a element where we need to perform mouseover operation. WebElement wb = driver.findelement(By.xpath(“….”)); Step-2: Create an object to Action class. Actions act = new Actions(driver); Step-3: Use Mouse over operation : act.moveToelement(wb).perform();
  • 10. Window Handling Step-1: Click the button which opens child window. WebElement wb = driver.findelement(By.xpath(“….”)); Step-2: Get all the current active window Id’s. Set<String> set = driver.getWindowHandles(); Step-3: Using iterator capture the Window Id’s from SET Iterator<String> itr = set.iterator(); String ParentID = itr.next(); String ChildID=itr.next(); Step-4: Pass driver control to child window. driver.switchTo().window(childID);
  • 11. Screenshots Step-1: EventFiringWebDriver dDriver = new EventFiringWebDriver(driver); Step-2: getScreenshotAs() method returns imagefile. File SrcImg = dDriver.getScreenshotAs(OutputType.File) File dstnImag = new File(“c:userscreenshottest.png”) Step-3: Get a help Apache poi, to store image in loca system. FileUtils.copyFile(srcImg , dstimg)
  • 12. How To DownLoad a file from a Browser FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.helperApps.neverAsk.saveToDisk"Mime type of the file”); How To Upload a file in a Browser First we need to install AutoIt WinActive(“$”) fileupload(give the path of the file you want to upload) ControlSetText(fileupload.$,edit1) ControlClick(fileupload,$,Button1) Save it .Au3 format Then in webdriver write “Runtime.getRuntime().exec("AutoIt .exe filepath");”
  • 13. Reading data from EXCEL Step-1: Specify the file path on which you are planning to interact. FileInputStream fis = new FileInputStream (Filepath); Step-2: Open WorkBook in Read Mode. Workbook wb = WorkbookFactory.create(fis); Step-3: Get the Control of the “Data” Sheet. Sheet sh = wb.getSheet(“Data”); Step-4: Get the Control of the 1st Row. Row row = sh.getRow(1); Step-5: Read the 2nd cell value from 1st Row. String userName = row.getCell(2).getStringCellValue(); String Password = row.getCell(3).getStringCellValue();
  • 14. Test-NG TestNG is a unit testing framework tool for Core java & .Net languages. Test-NG is implemented as a plugin for eclipse. Annotations in TestNG @Test @BeforeMethod @AfterMethod @BeforeClass @AfterClass @BeforeSuite @AfterSuite