SlideShare a Scribd company logo
Principles and Architecture of Sahi
   - Web Automation Simplified
           Narayan Raman
Primary Problem


Verify web application functionality

                  NOT

Build a browser automation tool or library
Browser or No Browser?
• At the protocol level – Parse extract and verify
  – Problem: No Javascript, no AJAX
• At the browser
  – Advantage:
     • Closer to the real world
     • Handles Javascript/AJAX etc.


                 BROWSER WINS
Browsers
• IE, Firefox, Chrome, Safari, Opera
• Multitude of Versions, often releasing rapidly
• No standards around browser automation
  APIs
  – No financial motivation for browser vendors to
    add these APIs and maintain them, especially on
    older versions
What the Tool needs to do
• Access elements on the browser using some
  API
• Simulate events such that they match the real
  user
Possibilities?
• Write wrappers around every browser, past
  and present
• Use something else
Constraints
• Developer time and expertise
  – Knowledge required of various browsers and their
    architectures
  – Need too many experts on too many languages
  – Need to be able to support and reproduce issues
    across multiple browser/OS combinations
• Lack of standards around browser automation
  APIs
Something Else? Javascript
• Running Javascript is one of the core features
  of every browser.
• Javascript can both identify elements (via the
  DOM) and simulate events.
• Small impediments:
  – Events generated on different browsers are
    different
  – The DOM may be different across browsers
Using Javascript
• Normalized/Simplified APIs to access DOM
• Normalized APIs for event simulation which
  are tailored for different browsers

                Let us call it Sahi APIs


• Is that it?
Execution?
• How does the web page have access to these
  APIs?
  – Script src tag may be?

  <script src=“sahiapis.js”></script>


  Let us assume that
Execution? Contd.
• Where is the script?
  – Add a js function to read a file (via an
    intermediate server) and execute it on the page
• Consider a 3 line script
  1 _setValue(_textbox(“login”), “user me”);
  2 _click(_submit(“Login”));
  // page refreshes
  3 _click(_button(“Compose”));
Execution? Contd.
• Page refresh flushes js memory/state
• Who remembers that the script is on line 3?
  – Need a memory space which does not change
    with each page load
  – May be in an Iframe or new window?
Problems
• Frame busting code
• Javascript Security:
  – Loosely put, page from one domain cannot talk to
    another
Solution
• Proxy injection
  – All browsers understand proxies and will continue
    to do so
  – Proxies let you inject code into web pages which
    the browser thinks is from the same domain
  – Can even work across domains, using the same
    techniques that are used for valid cross domain
    communication
Design Considerations
• Aimed at Developers or Testers?
  – Testers
     • Should be simple to learn and use
     • Should resort to as little code as possible
     • Helpers like recorders, object spy etc. are necessary
• Should the Sahi language be scriptable?
  – Sahi should read easily like DSL
  – But also be scriptable for added power
Language choice for Sahi
• Javascript is the language of the Web
• Users anyway need to know Javascript for success
  with web projects.
• The backend of web apps may vary from J2EE to
  RoR to PHP, but the front end is always HTML and
  JS. JS is the ideal choice.


• Sahi Script seamlessly interacts with browser
  javascript and also follows the Javascript syntax
Advantage of Javascript Events
• Does not need browser window to be in focus

• Can play back multiple browser tests
  simultaneously on browsers which allow
  cookie seclusion (Eg. Firefox/chrome profiles)
Sahi Script – Why not pure JS?
• Needs of a Web Testing DSL
  – Should wait for readiness of web page state
  – Should recover from errors automatically
  – For simplicity, this waiting and recovery should be
    internally handled by the DSL rather than by the
    user
  – More code = more maintenance
DEMO
Sahi APIs and Parsing
• Parsing done to:
  – Keep js code namespaces separate
  Eg. _sahi._click – All APIs belong to _sahi object.


• Allows for automatic logging, wait handling
  and error recovery
Simple Architecture

                           Sahi

                     Proxying + js code
                         injection        Web App
Browser

                     Local Processor
            /_s_/   Recorder + Player
                      Rhino Engine
The APIs
• _textbox(“username”)
  – “username” may be the name, id, className etc.
    Intelligent defaults used. Can be configured.


• APIs automatically recurse across frames and
  iframes.
Duplicates and Dynamic ids
• Duplicates are indexed
  – BUT, indexes may lead to brittle tests.


• Dynamic id patterns – Sahi knows common
  patterns to ignore. Can be configured.
  – Sahi will use properties other than id for these.
Contexts and UI Relations
• Remove index by passing contexts.
  – _link(“Edit”, _near(_cell(“Customer 1”)))
• All Sahi APIs can take contexts.
  – We call these UI Relations
• Relate dynamic elements with business
  concepts which are more concrete.
UI Relation APIs
• _near/_in
  – DOM based relations
• _under
  – Positional relation

  Eg. _link(“Edit”, _near(_cell(“Customer 1”)))
  Or
  _image(0, _near(_cell(“Customer 1”)), _under(_cell(“Delete”)))
frames/iframes across domains
• Sahi can handle pages which load multiple
  domains inside iframes.
  – Eg. Facebook login inside your web app.
• Javascript alone cannot go across
  frames/iframes
• But JS + Proxy combination removes the need
  for it
File Uploads
• Bypass the browser
• Append file content to request from inside the
  proxy
• Needs some small documented hack to
  handle browser validation of file fields.
More Goodness
• Works on any browser which supports a proxy
  and javascript.
  – Android, iOS browsers too
• Can modify http headers to simulate other
  mobile browsers
• Can force IE9 to work as IE7 or IE8 by adding
  relevant meta tags
Sahi
• Sahi
  – Open Source


• Sahi Pro
  – Commercial product

  Details: http://sahi.co.in/
Thank You

   V Narayan Raman
    http://sahi.co.in
Twitter: @narayanraman
         @_sahi

 Tyto Software Pvt. Ltd.

More Related Content

What's hot

Sahi my expirience
Sahi my expirienceSahi my expirience
Sahi my expirienceAkss004
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
ericjamesblackburn
 
Economical, Robust Web Automation using Sahi
Economical, Robust Web Automation using SahiEconomical, Robust Web Automation using Sahi
Economical, Robust Web Automation using SahiRIA RUI Society
 
Java script Tutorial - QaTrainingHub
Java script Tutorial - QaTrainingHubJava script Tutorial - QaTrainingHub
Java script Tutorial - QaTrainingHub
QA TrainingHub
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
iMOBDEV Technologies Pvt. Ltd.
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
Ashwin Date
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
Knoldus Inc.
 
Web application framework
Web application frameworkWeb application framework
Web application framework
Pankaj Chand
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
TurnToTech
 
AEM responsive
AEM responsiveAEM responsive
AEM responsive
Damien Antipa
 
AngularJS and SharePoint
AngularJS and SharePointAngularJS and SharePoint
AngularJS and SharePoint
danielsmon
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
Mohammed Makhlouf
 
Joomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiencesJoomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiences
Andy_Gaskell
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.
Herman Peeren
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
Rhoynar Software Consulting
 
Back to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
Clint LaForest
 
Support Tools für die Admin-Konsole - Nebil Kisa, Advanced Support Engineer
Support Tools für die Admin-Konsole - Nebil Kisa, Advanced Support EngineerSupport Tools für die Admin-Konsole - Nebil Kisa, Advanced Support Engineer
Support Tools für die Admin-Konsole - Nebil Kisa, Advanced Support Engineer
Nicole Szigeti
 
Demystifying Selenium framework
Demystifying Selenium frameworkDemystifying Selenium framework
Demystifying Selenium framework
kunalgate125
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & cons
ElenorWisozk
 

What's hot (20)

Sahi my expirience
Sahi my expirienceSahi my expirience
Sahi my expirience
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
Economical, Robust Web Automation using Sahi
Economical, Robust Web Automation using SahiEconomical, Robust Web Automation using Sahi
Economical, Robust Web Automation using Sahi
 
Java script Tutorial - QaTrainingHub
Java script Tutorial - QaTrainingHubJava script Tutorial - QaTrainingHub
Java script Tutorial - QaTrainingHub
 
Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016Top 10 web application development frameworks 2016
Top 10 web application development frameworks 2016
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
 
Web application framework
Web application frameworkWeb application framework
Web application framework
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
 
AEM responsive
AEM responsiveAEM responsive
AEM responsive
 
AngularJS and SharePoint
AngularJS and SharePointAngularJS and SharePoint
AngularJS and SharePoint
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
 
Joomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiencesJoomla as a mobile App backend - ideas, examples and experiences
Joomla as a mobile App backend - ideas, examples and experiences
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.Webservices: connecting Joomla! with other programs.
Webservices: connecting Joomla! with other programs.
 
Test Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and CucumberTest Automation Framework with BDD and Cucumber
Test Automation Framework with BDD and Cucumber
 
Back to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
 
Support Tools für die Admin-Konsole - Nebil Kisa, Advanced Support Engineer
Support Tools für die Admin-Konsole - Nebil Kisa, Advanced Support EngineerSupport Tools für die Admin-Konsole - Nebil Kisa, Advanced Support Engineer
Support Tools für die Admin-Konsole - Nebil Kisa, Advanced Support Engineer
 
Demystifying Selenium framework
Demystifying Selenium frameworkDemystifying Selenium framework
Demystifying Selenium framework
 
Laravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & consLaravel and CodeIgniter: pros & cons
Laravel and CodeIgniter: pros & cons
 

Viewers also liked

Sahi - Effective Web Testing
Sahi - Effective Web TestingSahi - Effective Web Testing
Sahi - Effective Web Testing
Tyto Software
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
Nivetha Padmanaban
 
Bug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutionsBug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutionsRIA RUI Society
 
Sahi Conference
Sahi ConferenceSahi Conference
Sahi Conference
Nivetha Padmanaban
 
Sahi-Web Automation and Testing Tool
Sahi-Web Automation and Testing ToolSahi-Web Automation and Testing Tool
Sahi-Web Automation and Testing ToolKurapati Vishwak
 
Rpt ppt
Rpt pptRpt ppt
Rpt ppt
sindhu T
 
Contratos comerciales
Contratos comercialesContratos comerciales
Contratos comerciales
PARGO
 
Agile India 2016 Conference
Agile India 2016 ConferenceAgile India 2016 Conference
Agile India 2016 Conference
Naresh Jain
 
Contratos De Compra Y Venta Internacional
Contratos  De Compra Y Venta InternacionalContratos  De Compra Y Venta Internacional
Contratos De Compra Y Venta Internacionalesjuemlinaresvizcarra
 
Agile India 2017 Conference
Agile India 2017 ConferenceAgile India 2017 Conference
Agile India 2017 Conference
Naresh Jain
 

Viewers also liked (10)

Sahi - Effective Web Testing
Sahi - Effective Web TestingSahi - Effective Web Testing
Sahi - Effective Web Testing
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
 
Bug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutionsBug debug keynote - Present problems and future solutions
Bug debug keynote - Present problems and future solutions
 
Sahi Conference
Sahi ConferenceSahi Conference
Sahi Conference
 
Sahi-Web Automation and Testing Tool
Sahi-Web Automation and Testing ToolSahi-Web Automation and Testing Tool
Sahi-Web Automation and Testing Tool
 
Rpt ppt
Rpt pptRpt ppt
Rpt ppt
 
Contratos comerciales
Contratos comercialesContratos comerciales
Contratos comerciales
 
Agile India 2016 Conference
Agile India 2016 ConferenceAgile India 2016 Conference
Agile India 2016 Conference
 
Contratos De Compra Y Venta Internacional
Contratos  De Compra Y Venta InternacionalContratos  De Compra Y Venta Internacional
Contratos De Compra Y Venta Internacional
 
Agile India 2017 Conference
Agile India 2017 ConferenceAgile India 2017 Conference
Agile India 2017 Conference
 

Similar to Sahi Principles and Architecture

Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app
Ivano Malavolta
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
edm00se
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
tactqa
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
tactqa
 
Rhodes
RhodesRhodes
Rhodes
jwallace41
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
IT Arena
 
Tests for Scalable, Fast, Secure Apps
Tests for Scalable, Fast, Secure AppsTests for Scalable, Fast, Secure Apps
Tests for Scalable, Fast, Secure Apps
Atlogys Technical Consulting
 
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
Kushan Lahiru Perera
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )
senthil0809
 
Javascript & Jquery
Javascript & JqueryJavascript & Jquery
Javascript & Jquery
Gurpreet singh
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
Henry S
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
Ivano Malavolta
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
Sachin Walvekar
 
Php Web Frameworks
Php Web FrameworksPhp Web Frameworks
Php Web Frameworks
Shreyans Jasoriya
 
Sahi
SahiSahi
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
Camuel Gilyadov
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
Microsoft Developer Network (MSDN) - Belgium and Luxembourg
 

Similar to Sahi Principles and Architecture (20)

20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app Anatomy of an HTML 5 mobile web app
Anatomy of an HTML 5 mobile web app
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Firefox OS Weekend
Firefox OS WeekendFirefox OS Weekend
Firefox OS Weekend
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
 
Microsoft power point automation-opensourcetestingtools_matrix-1
Microsoft power point   automation-opensourcetestingtools_matrix-1Microsoft power point   automation-opensourcetestingtools_matrix-1
Microsoft power point automation-opensourcetestingtools_matrix-1
 
Rhodes
RhodesRhodes
Rhodes
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Tests for Scalable, Fast, Secure Apps
Tests for Scalable, Fast, Secure AppsTests for Scalable, Fast, Secure Apps
Tests for Scalable, Fast, Secure Apps
 
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )
 
Javascript & Jquery
Javascript & JqueryJavascript & Jquery
Javascript & Jquery
 
Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
Php Web Frameworks
Php Web FrameworksPhp Web Frameworks
Php Web Frameworks
 
Sahi
SahiSahi
Sahi
 
20120802 timisoara
20120802 timisoara20120802 timisoara
20120802 timisoara
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
Building SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.jsBuilding SPA’s (Single Page App) with Backbone.js
Building SPA’s (Single Page App) with Backbone.js
 

Recently uploaded

Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Sahi Principles and Architecture

  • 1. Principles and Architecture of Sahi - Web Automation Simplified Narayan Raman
  • 2. Primary Problem Verify web application functionality NOT Build a browser automation tool or library
  • 3. Browser or No Browser? • At the protocol level – Parse extract and verify – Problem: No Javascript, no AJAX • At the browser – Advantage: • Closer to the real world • Handles Javascript/AJAX etc. BROWSER WINS
  • 4. Browsers • IE, Firefox, Chrome, Safari, Opera • Multitude of Versions, often releasing rapidly • No standards around browser automation APIs – No financial motivation for browser vendors to add these APIs and maintain them, especially on older versions
  • 5. What the Tool needs to do • Access elements on the browser using some API • Simulate events such that they match the real user
  • 6. Possibilities? • Write wrappers around every browser, past and present • Use something else
  • 7. Constraints • Developer time and expertise – Knowledge required of various browsers and their architectures – Need too many experts on too many languages – Need to be able to support and reproduce issues across multiple browser/OS combinations • Lack of standards around browser automation APIs
  • 8. Something Else? Javascript • Running Javascript is one of the core features of every browser. • Javascript can both identify elements (via the DOM) and simulate events. • Small impediments: – Events generated on different browsers are different – The DOM may be different across browsers
  • 9. Using Javascript • Normalized/Simplified APIs to access DOM • Normalized APIs for event simulation which are tailored for different browsers Let us call it Sahi APIs • Is that it?
  • 10. Execution? • How does the web page have access to these APIs? – Script src tag may be? <script src=“sahiapis.js”></script> Let us assume that
  • 11. Execution? Contd. • Where is the script? – Add a js function to read a file (via an intermediate server) and execute it on the page • Consider a 3 line script 1 _setValue(_textbox(“login”), “user me”); 2 _click(_submit(“Login”)); // page refreshes 3 _click(_button(“Compose”));
  • 12. Execution? Contd. • Page refresh flushes js memory/state • Who remembers that the script is on line 3? – Need a memory space which does not change with each page load – May be in an Iframe or new window?
  • 13. Problems • Frame busting code • Javascript Security: – Loosely put, page from one domain cannot talk to another
  • 14. Solution • Proxy injection – All browsers understand proxies and will continue to do so – Proxies let you inject code into web pages which the browser thinks is from the same domain – Can even work across domains, using the same techniques that are used for valid cross domain communication
  • 15. Design Considerations • Aimed at Developers or Testers? – Testers • Should be simple to learn and use • Should resort to as little code as possible • Helpers like recorders, object spy etc. are necessary • Should the Sahi language be scriptable? – Sahi should read easily like DSL – But also be scriptable for added power
  • 16. Language choice for Sahi • Javascript is the language of the Web • Users anyway need to know Javascript for success with web projects. • The backend of web apps may vary from J2EE to RoR to PHP, but the front end is always HTML and JS. JS is the ideal choice. • Sahi Script seamlessly interacts with browser javascript and also follows the Javascript syntax
  • 17. Advantage of Javascript Events • Does not need browser window to be in focus • Can play back multiple browser tests simultaneously on browsers which allow cookie seclusion (Eg. Firefox/chrome profiles)
  • 18. Sahi Script – Why not pure JS? • Needs of a Web Testing DSL – Should wait for readiness of web page state – Should recover from errors automatically – For simplicity, this waiting and recovery should be internally handled by the DSL rather than by the user – More code = more maintenance
  • 19. DEMO
  • 20. Sahi APIs and Parsing • Parsing done to: – Keep js code namespaces separate Eg. _sahi._click – All APIs belong to _sahi object. • Allows for automatic logging, wait handling and error recovery
  • 21. Simple Architecture Sahi Proxying + js code injection Web App Browser Local Processor /_s_/ Recorder + Player Rhino Engine
  • 22. The APIs • _textbox(“username”) – “username” may be the name, id, className etc. Intelligent defaults used. Can be configured. • APIs automatically recurse across frames and iframes.
  • 23. Duplicates and Dynamic ids • Duplicates are indexed – BUT, indexes may lead to brittle tests. • Dynamic id patterns – Sahi knows common patterns to ignore. Can be configured. – Sahi will use properties other than id for these.
  • 24. Contexts and UI Relations • Remove index by passing contexts. – _link(“Edit”, _near(_cell(“Customer 1”))) • All Sahi APIs can take contexts. – We call these UI Relations • Relate dynamic elements with business concepts which are more concrete.
  • 25. UI Relation APIs • _near/_in – DOM based relations • _under – Positional relation Eg. _link(“Edit”, _near(_cell(“Customer 1”))) Or _image(0, _near(_cell(“Customer 1”)), _under(_cell(“Delete”)))
  • 26. frames/iframes across domains • Sahi can handle pages which load multiple domains inside iframes. – Eg. Facebook login inside your web app. • Javascript alone cannot go across frames/iframes • But JS + Proxy combination removes the need for it
  • 27. File Uploads • Bypass the browser • Append file content to request from inside the proxy • Needs some small documented hack to handle browser validation of file fields.
  • 28. More Goodness • Works on any browser which supports a proxy and javascript. – Android, iOS browsers too • Can modify http headers to simulate other mobile browsers • Can force IE9 to work as IE7 or IE8 by adding relevant meta tags
  • 29. Sahi • Sahi – Open Source • Sahi Pro – Commercial product Details: http://sahi.co.in/
  • 30. Thank You V Narayan Raman http://sahi.co.in Twitter: @narayanraman @_sahi Tyto Software Pvt. Ltd.