SlideShare a Scribd company logo
1 of 13
Sandeep Tol
Senior Architect, Wipro
Selenium Automation with HTTPWatch Plugin
 Selenium framework allows to simulate real browser like Internet explorer,
Chrome or Firefox and automate the execution of user navigations via scripts in
the browser. There are enormous articles, tutorials available on automation with
selenium. However there is focus given for capturing web page performance
KPIs,page load times & Browser HTTP network logs during such Selenium test
runs.
 Currently there is no Java API available to interface Http Watch plug-in API.
solution given in this article show how to use HTTP Watch browser plug-in
,collect logs and measure page performance with Java .
 This document would help developers/Testers to write to use Java
programming for selenium scripts with capturing HTTP log data using
HTTPWatch plugin & capture performance KPI of pages and automate in
detection of web performance issues.
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 2
About HTTPWatch Plug-in
 HttpWatch browser plug-in helps to measure Performance of web pages like Page
Load time, Number of Javaacript files, Number of CSS files, Number of HTTP
Errors, Number of requests etc in Internet Explorer or Firefox . HTTP Watch is
external plug-in available in Basic & professional edition for Internet explorer to
capture HTTP logs. One can also buy Professional Edition that comes with more
features for detailed analysis. Free Basic edition is enough for most of the cases!
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 3
Java Interfacing for Http Watch Plugin
 HTTP Watch comes with inbuilt API support to integrate with selenium scripts written in C# or PHP
scripts . Refer http://apihelp.httpwatch.com/#Automation%20Overview.html
 But unfortunately we don’t have API written for JAVA. The solution is to use Java COM bridge and invoke
HTTP Watch plugin API from Java selenium scripts.
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 4
HttpWatch Plugin
-Record
-Stop
-Log
Java Selenium Code
JavaComBridge
Pages Summary
-Load Times, URL Data
- Content Sizes (CSS/JSS,IMG
sizes) , Save Log files
HWL Files
( Log files)
Java Based HttpWatch Automation with
Selenium
Controller
 Step 1 :
Download and install HTTPwatch plug-in for IE in your system. You can download here download
Ensure that latest Install JRE or JDK is available on system
 Step 2 :
Download COM Bridge https://java.net/projects/com4j/downloads and unzip files . There are few other
commercial java com bridge available. But I found the above one is good and efficient . You can also refer
to tutorial on converting various COM objects into Java interfaces here.
https://com4j.java.net/tutorial.html
 Step 3 :
Open “Command Prompt” and navigate to the folder where you have extracted Com4J files .
Copy HTTPWatchx64.dll ( for 32 bit Windows it would be httpwatch.dll) from HTTPwatch plugin
installation folder to same folder where COM4J files are extracted. On Windows the HTTPwatch would be
installed in C:Program Files (x86)HttpWatch
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 5
 Step 4 :
Convert COM component to Java API
. Execute following command
Java – jar tlbimp.jar -o <outputFolder> –p <packagename> DLL file
Below command would generate files in “output” folder
Java – jar tlbimp.jar -o outputFolder –p com.httpwatch httpwatchx64.dll
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 6
Generated Java Interface files
for HTTPWatch Plugin
Java Selenium Code with Http Watch Plugin
 Include the httpwatch API that was generated into your selenium project. Below is
the code used in Ecipse IDE after importing httpWatch API classes.
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 7
Java Selenium Code with Http Watch Plugin
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 8
public class SeleniumIEHttpwatch {
public static void main(String[] args) {
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
WebDriver driver = new InternetExplorerDriver(capabilitiesIE);
IController controller = ClassFactory.createController();
driver.manage().window().maximize();
// And now use this to visit Google
driver.get("http://www.google.com");
// Check the title of the page
String title = driver.getTitle();
// Creae Plugin instance
Plugin plugin = controller.attachByTitle(title);
// Do some transaction in page e.g Search
//WebElement element = driver.findElement(By.name("q"));
// Enter something to search for
element.sendKeys("Cheese!");
//start recording the data for transaction
plugin.record();
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
controller.wait_(plugin, -1);
//stop recording for transaction
plugin.stop();
// Save the log file
plugin.log().save("C:/<local path>/googletest.hwl");
} }
We can also Print Performance metrics of page
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 9
/*Get the Summary of Performance KPI*/
Summary summary = plugin.log().pages(0).entries().summary();
System.out.println(" Summary Time" + summary.time());
System.out.println( "Total time to load page (secs): " + summary.time());
System.out.println( "Number of bytes received on network: " + summary.bytesReceived());
System.out.println( "HTTP compression saving (bytes): " + summary.compressionSavedBytes());
System.out.println( "Number of round trips: " + summary.roundTrips());
System.out.println( "Number of errors: " + summary.errors().count());
The Execution Console Output will look like this
Auto generated HWL File would like this. You can also
export this content to CSV format
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 10
 If you would like to simulate the HTTP Watch with Mozilla Firefox . Below is the
code .There are few minor modifications needed to invoke HTTPWatch plugin .
Please note the HTTPwatch plugin only works for Firefox version 35 and
below
FirefoxProfile profile = new FirefoxProfile();
// FireBug,NetExport,Modify Headers xpi
File httpwatch = new File("C:Program Files (x86)HttpWatchFirefox");
profile.setEnableNativeEvents(false);
try {
profile.addExtension(httpwatch);
} catch (IOException err) {
System.out.println(err);
}
WebDriver driver = new FirefoxDriver(profile);
driver.get("http://www.google.com");
String title = driver.getTitle();
System.out.println(" Title1 - " + title);
Plugin plugin = controller.attachByTitle(title);
Rest of the code is same for Plugin recording and transaction simulationss
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 11
 Download Code Project from GiHub
https://github.com/sandeeptol1/SampleJavaHttpWatchAutomation
 Software Test Automation is brining lot of innovative tools and techniques to
automate manual testing and reduce testing efforts. Especially in Agile Projects or
Next gen architectures, automation is the key to successful project
implementations. Many Enterprises are using automated scripts for Junit tests,
Selenium Web browser Tests in their CI/CD ( Continuous Integration)
frameworks to reduce cycle time and manual efforts on Unit testing, Browser
testing & regression testing . Automation is “mantra” in nexgen architecture.
 Selenium can be used for automating regression tests and browser based tests or
Website comparison tests against competition. Using above techniques httplogs
can also be collected during such tests . This data can be stored in some database
or files and can be shown in dashboards to view website performance
 References
HTTPWatch API http://apihelp.httpwatch.com/#Automation%20Overview.html
COM 4 Java https://com4j.java.net/tutorial.html
Selenium Webdriver http://www.seleniumhq.org/projects/webdriver/
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 12
About the Author
 Sandeep Tol is Senior Architect at Wipro, with technology experience spanning
across Java J2EE applications, Web Portals, SOA platforms, Digital, Mobile, Cloud
architectures & Performance Engineering .Certified in TOGAF 9, written various
whitepapers published on architecture and quality governance.
Has Special Interest in Test Automation and Performance Engineering .Developed
and implemented various performance engineering automation tools,’ left shift
strategies to various customers
https://www.linkedin.com/in/sandeeptol
email: sandeep.tol@outlook.com
Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 13

More Related Content

What's hot

Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...Vietnam Open Infrastructure User Group
 
CMS Testing Strategy & CQ5 CMS
CMS Testing Strategy & CQ5 CMSCMS Testing Strategy & CQ5 CMS
CMS Testing Strategy & CQ5 CMSRachana Khedekar
 
Selenium Grid
Selenium GridSelenium Grid
Selenium Gridnirvdrum
 
Data driven Automation Framework with Selenium
Data driven Automation Framework with Selenium Data driven Automation Framework with Selenium
Data driven Automation Framework with Selenium Edureka!
 
Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...
Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...
Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...Edureka!
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverPankaj Biswas
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using SeleniumWeifeng Zhang
 
WebLogic Scripting Tool Overview
WebLogic Scripting Tool OverviewWebLogic Scripting Tool Overview
WebLogic Scripting Tool OverviewJames Bayer
 
Python selenium
Python seleniumPython selenium
Python seleniumDucat
 
HTTP HOST header attacks
HTTP HOST header attacksHTTP HOST header attacks
HTTP HOST header attacksDefconRussia
 
TestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | EdurekaTestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | EdurekaEdureka!
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - IntroductionAmr E. Mohamed
 
Intégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsIntégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsKokou Gaglo
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...Simplilearn
 

What's hot (20)

Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
Room 3 - 1 - Nguyễn Xuân Trường Lâm - Zero touch on-premise storage infrastru...
 
CMS Testing Strategy & CQ5 CMS
CMS Testing Strategy & CQ5 CMSCMS Testing Strategy & CQ5 CMS
CMS Testing Strategy & CQ5 CMS
 
Selenium Grid
Selenium GridSelenium Grid
Selenium Grid
 
Data driven Automation Framework with Selenium
Data driven Automation Framework with Selenium Data driven Automation Framework with Selenium
Data driven Automation Framework with Selenium
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...
Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...
Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beg...
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Automated Web Testing Using Selenium
Automated Web Testing Using SeleniumAutomated Web Testing Using Selenium
Automated Web Testing Using Selenium
 
WebLogic Scripting Tool Overview
WebLogic Scripting Tool OverviewWebLogic Scripting Tool Overview
WebLogic Scripting Tool Overview
 
Python selenium
Python seleniumPython selenium
Python selenium
 
HTTP HOST header attacks
HTTP HOST header attacksHTTP HOST header attacks
HTTP HOST header attacks
 
TestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | EdurekaTestNG Annotations in Selenium | Edureka
TestNG Annotations in Selenium | Edureka
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Java Spring
Java SpringJava Spring
Java Spring
 
Intégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec JenkinsIntégration continue et déploiement continue avec Jenkins
Intégration continue et déploiement continue avec Jenkins
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
 

Similar to Selenium Automation in Java Using HttpWatch Plug-in

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 ocjugPhilip Schlesinger
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.comtestingbot
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 
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
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
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!Puneet Kala
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With SeleniumMarakana Inc.
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Peyman Fakharian
 

Similar to Selenium Automation in Java Using HttpWatch Plug-in (20)

Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium
SeleniumSelenium
Selenium
 
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
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.com
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
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 WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Selenium
SeleniumSelenium
Selenium
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Selenium
SeleniumSelenium
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!
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Testing Java Web Apps With Selenium
Testing Java Web Apps With SeleniumTesting Java Web Apps With Selenium
Testing Java Web Apps With Selenium
 
Qa process
Qa processQa process
Qa process
 
Codeception
CodeceptionCodeception
Codeception
 
Qa process
Qa processQa process
Qa process
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
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 AmsterdamUiPathCommunity
 
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...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
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 SavingEdi Saputra
 
"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 ...Zilliz
 
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 FMESafe Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
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 2024Victor Rentea
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 2024Victor Rentea
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
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...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
"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 ...
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 

Selenium Automation in Java Using HttpWatch Plug-in

  • 2. Selenium Automation with HTTPWatch Plugin  Selenium framework allows to simulate real browser like Internet explorer, Chrome or Firefox and automate the execution of user navigations via scripts in the browser. There are enormous articles, tutorials available on automation with selenium. However there is focus given for capturing web page performance KPIs,page load times & Browser HTTP network logs during such Selenium test runs.  Currently there is no Java API available to interface Http Watch plug-in API. solution given in this article show how to use HTTP Watch browser plug-in ,collect logs and measure page performance with Java .  This document would help developers/Testers to write to use Java programming for selenium scripts with capturing HTTP log data using HTTPWatch plugin & capture performance KPI of pages and automate in detection of web performance issues. Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 2
  • 3. About HTTPWatch Plug-in  HttpWatch browser plug-in helps to measure Performance of web pages like Page Load time, Number of Javaacript files, Number of CSS files, Number of HTTP Errors, Number of requests etc in Internet Explorer or Firefox . HTTP Watch is external plug-in available in Basic & professional edition for Internet explorer to capture HTTP logs. One can also buy Professional Edition that comes with more features for detailed analysis. Free Basic edition is enough for most of the cases! Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 3
  • 4. Java Interfacing for Http Watch Plugin  HTTP Watch comes with inbuilt API support to integrate with selenium scripts written in C# or PHP scripts . Refer http://apihelp.httpwatch.com/#Automation%20Overview.html  But unfortunately we don’t have API written for JAVA. The solution is to use Java COM bridge and invoke HTTP Watch plugin API from Java selenium scripts. Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 4 HttpWatch Plugin -Record -Stop -Log Java Selenium Code JavaComBridge Pages Summary -Load Times, URL Data - Content Sizes (CSS/JSS,IMG sizes) , Save Log files HWL Files ( Log files) Java Based HttpWatch Automation with Selenium Controller
  • 5.  Step 1 : Download and install HTTPwatch plug-in for IE in your system. You can download here download Ensure that latest Install JRE or JDK is available on system  Step 2 : Download COM Bridge https://java.net/projects/com4j/downloads and unzip files . There are few other commercial java com bridge available. But I found the above one is good and efficient . You can also refer to tutorial on converting various COM objects into Java interfaces here. https://com4j.java.net/tutorial.html  Step 3 : Open “Command Prompt” and navigate to the folder where you have extracted Com4J files . Copy HTTPWatchx64.dll ( for 32 bit Windows it would be httpwatch.dll) from HTTPwatch plugin installation folder to same folder where COM4J files are extracted. On Windows the HTTPwatch would be installed in C:Program Files (x86)HttpWatch Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 5
  • 6.  Step 4 : Convert COM component to Java API . Execute following command Java – jar tlbimp.jar -o <outputFolder> –p <packagename> DLL file Below command would generate files in “output” folder Java – jar tlbimp.jar -o outputFolder –p com.httpwatch httpwatchx64.dll Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 6 Generated Java Interface files for HTTPWatch Plugin
  • 7. Java Selenium Code with Http Watch Plugin  Include the httpwatch API that was generated into your selenium project. Below is the code used in Ecipse IDE after importing httpWatch API classes. Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 7
  • 8. Java Selenium Code with Http Watch Plugin Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 8 public class SeleniumIEHttpwatch { public static void main(String[] args) { InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); WebDriver driver = new InternetExplorerDriver(capabilitiesIE); IController controller = ClassFactory.createController(); driver.manage().window().maximize(); // And now use this to visit Google driver.get("http://www.google.com"); // Check the title of the page String title = driver.getTitle(); // Creae Plugin instance Plugin plugin = controller.attachByTitle(title); // Do some transaction in page e.g Search //WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); //start recording the data for transaction plugin.record(); // Now submit the form. WebDriver will find the form for us from the element element.submit(); controller.wait_(plugin, -1); //stop recording for transaction plugin.stop(); // Save the log file plugin.log().save("C:/<local path>/googletest.hwl"); } }
  • 9. We can also Print Performance metrics of page Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 9 /*Get the Summary of Performance KPI*/ Summary summary = plugin.log().pages(0).entries().summary(); System.out.println(" Summary Time" + summary.time()); System.out.println( "Total time to load page (secs): " + summary.time()); System.out.println( "Number of bytes received on network: " + summary.bytesReceived()); System.out.println( "HTTP compression saving (bytes): " + summary.compressionSavedBytes()); System.out.println( "Number of round trips: " + summary.roundTrips()); System.out.println( "Number of errors: " + summary.errors().count()); The Execution Console Output will look like this
  • 10. Auto generated HWL File would like this. You can also export this content to CSV format Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 10
  • 11.  If you would like to simulate the HTTP Watch with Mozilla Firefox . Below is the code .There are few minor modifications needed to invoke HTTPWatch plugin . Please note the HTTPwatch plugin only works for Firefox version 35 and below FirefoxProfile profile = new FirefoxProfile(); // FireBug,NetExport,Modify Headers xpi File httpwatch = new File("C:Program Files (x86)HttpWatchFirefox"); profile.setEnableNativeEvents(false); try { profile.addExtension(httpwatch); } catch (IOException err) { System.out.println(err); } WebDriver driver = new FirefoxDriver(profile); driver.get("http://www.google.com"); String title = driver.getTitle(); System.out.println(" Title1 - " + title); Plugin plugin = controller.attachByTitle(title); Rest of the code is same for Plugin recording and transaction simulationss Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 11
  • 12.  Download Code Project from GiHub https://github.com/sandeeptol1/SampleJavaHttpWatchAutomation  Software Test Automation is brining lot of innovative tools and techniques to automate manual testing and reduce testing efforts. Especially in Agile Projects or Next gen architectures, automation is the key to successful project implementations. Many Enterprises are using automated scripts for Junit tests, Selenium Web browser Tests in their CI/CD ( Continuous Integration) frameworks to reduce cycle time and manual efforts on Unit testing, Browser testing & regression testing . Automation is “mantra” in nexgen architecture.  Selenium can be used for automating regression tests and browser based tests or Website comparison tests against competition. Using above techniques httplogs can also be collected during such tests . This data can be stored in some database or files and can be shown in dashboards to view website performance  References HTTPWatch API http://apihelp.httpwatch.com/#Automation%20Overview.html COM 4 Java https://com4j.java.net/tutorial.html Selenium Webdriver http://www.seleniumhq.org/projects/webdriver/ Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 12
  • 13. About the Author  Sandeep Tol is Senior Architect at Wipro, with technology experience spanning across Java J2EE applications, Web Portals, SOA platforms, Digital, Mobile, Cloud architectures & Performance Engineering .Certified in TOGAF 9, written various whitepapers published on architecture and quality governance. Has Special Interest in Test Automation and Performance Engineering .Developed and implemented various performance engineering automation tools,’ left shift strategies to various customers https://www.linkedin.com/in/sandeeptol email: sandeep.tol@outlook.com Selenium Automation with HTTPWatch Plug-in Sandeep.tol@outlook.com 13