SlideShare une entreprise Scribd logo
1  sur  15
Sahi Tutorial

Introduction

Sahi is an open source testing tool for web applications, with the facility to record and playback
scripts. Developed in Javaâ„¢ and Javascript, this tool uses simple Javascript to execute events in
the browser.

Features:

In-browser controls
Intelligent recorder
Text-based scripts
Ant support for playback of suites of tests
Multi-threaded playback from a command line
HTTP and HTTPS support
AJAX support

Sahi runs as a proxy server which intercepts traffic from the web browser and records the web
browsing actions. Sahi can play back those recorded actions by injecting Javascript into the
browser so it can access elements in the web page. This makes the tool independent of the
website/ web application.

Sahi is similar to Selenium (http://www.openqa.org/selenium-ide/) but is not browser specific
like Selenium is. Sahi works with Firefox, Internet Explorer, Opera, and Safari whereas
Selenium is Firefox only. In addition, Selenium has to be deployed to the server the web
application resides on. Sahi just needs a browser that can display the web application.

Sahi is released under the Apache License, Version 2.0.



Prerequisites

Sahi requires Java 1.4 and above. You can get Java here.



Installing Sahi

You can download Sahi and the source code from here. The latest build (the one at the top of the
list) is the one you want.

Unzip sahi.zip to a convenient directory of your choosing. That's it!
Running Sahi

Navigate to the Sahi directory you extracted and:

Windows: Go to bin and run sahi.bat
Linux and Mac: Go to /bin and run sahi.sh

The Sahi proxy server will start and begin listening for traffic on port 9999.

NOTE: by default Sahi uses port 9999. This can be modified through sahi.properties in the
config directory.

Now that the Sahi proxy server is running, it's time to configure the web browser to use it.



Configuring the browser

Firefox:
Go to Tools > Options > Advanced > Connection Settings >
Set to "Manual Proxy Configuration"
Set "HTTP Proxy" to "localhost"
Set "Port" to "9999".
Do the same for "SSL Proxy" too, if you wish to record and playback HTTPS traffic
Keep "Use the same proxy for all protocol" unchecked as Sahi does not understand protocols
other than HTTP

NOTE: "No Proxy for" should NOT have localhost or 127.0.0.1 or the domain of the test
application in it.

Internet Explorer:

Go to Tools > Internet Options > Connections > LAN Settings >
In "Proxy server" section, check "Use a proxy server for your LAN"
Set "Address" to "localhost"
Set "Port" to "9999"
Leave "Bypass proxy server for local addresses" unchecked
Click OK > OK



Opera:

Go to Tools > Preferences > Network
Click "Proxy servers" button
Check "HTTP"
Enter localhost in the textbox
Enter "9999" for Port
Click Ok > Ok
Repeat the above if you wish to record and playback HTTPS traffic

Safari:

Go to Edit > Preferences
Select "Advanced"
click "Change Settings" for Proxies
Click "LAN Settings" button
In "Proxy server" section, check "Use a proxy server for your LAN"
Set "Address" to "localhost"
Set "Port" to "9999"
Leave "Bypass proxy server for local addresses" unchecked
Click OK > OK



Testing with Sahi

Now that the Sahi proxy server is running and the web browser is configured to talk to the proxy,
it is time to start using Sahi! We'll start out by using Sahi to navigate a webpage:

Open http://www.Google.com/ in your web browser
After Google loads, hold down the Ctrl and Alt keys and then double-click the web page.

The Sahi Controller should now appear:
The Sahi Controller has two tabs: Record and Playback. We will start by recording the
navigation steps.

The "Script Directory" field shows you where the script will be saved. By default Sahi saves to
the "scripts" directory.

NOTE: This directory can be changed via sahi.properties in the "config" directory.

Enter "Test" in the "Script Name" text field and press the "Record" button
In the web browser, enter "Sahi" in the Google search box
Now click the "Google Search" button
Click the "Stop" button in the Sahi Controller

So far, so good!

Now to play back what we just recorded:

Click the "Playback" tab in the Sahi Controller
Select "Test.sah" in the "File" selection list
Enter "http://www.Google.com/" in the "Start URL" text field
Click the "Set" button
Wait for the web page in the browser to reload
Click the "Play" button
The web browser loads the Google search page, "Sahi" is entered in the search box, and the
button "Google Search" is clicked.

Clicking "Set" loaded the test script and opened the target page for the start of the test.

Sahi entered "Shai" into the textbox named "q" using the following statement:
_setValue(_textbox("q"), "Sahi");

After the text was entered, Sahi click the submit button labeled "Google Search" with this
statement:
   _click(_submit("Google Search"));
And finally Sahi signaled that the test was successful:
  --Stopped Playback: SUCCESS--

Leave the Google results page open and we'll add a test to find an image on the page....

Click the "Record" tab again
Enter "Test" in the "Script Name" text box
Click the "Record" button
Hold down the "Ctrl" key and move the mouse cursor over the link for "Sahi" in the search
results
Click the "Assert" button
Click the "Text -->" button
Click the "Apend to Script" button
Finally, click the Stop button
Notice that the "Accessor" and "Alternative" fields have been filled in.

The "Accessor" indicates that Sahi found the link by the text it contains.

The "Alternative" indicates where Sahi found the link in the Document Object Model hierarchy.

Clicking the "Assert" button added a condition stating that we believe the link "Sahi" exists on
the web page. By clicking the "Test -->" button, we asked Sahi to verify that the link existed.
The link did exist and to Sahi answered "true". We added the assert to the script.
Let's run the script again with the assert added to it:
Success!

We are now able to open a web page, fill in a form, submit the form, and test the results.

You are encouraged to experiment with setting assertions for different web page elements and
testing for them with Sahi scripts.



A Closer Look At The Sahi Controller
Let's find out what the other buttons on the Record tab do...

Open http://www.Google.com/ in the browser again
Click the "Record" tab in the Sahi Controller
Hold down the "Ctrl" key and hover the mouse over the Google search box.
Click the "Props" button in the Sahi Controller

The "evaluate expression" box displays the properties of the Google search box.

You can expand the Sahi Controller by dragging the corners if you need more reading area.

Click the "Hilight" button

A red box highlights the search box. This is good technique to use if other people will be using
your Sahi scripts so they know what is being tested.

In the "Value" text box, enter "Sahi is great"
Click the "Set" button

The Sahi Controller enters "Sahi" in to the Google search box.

Hold down the "Ctrl" key and hover the mouse over the "Google Search" button
Click the "Click" button

The Sahi Controller clicks the button for you and the browser navigates to the search results.

If for some reason you need a Sahi script to pause, you can insert a "Wait" for a specified
number of milliseconds (1000 ms = 1 second).
You can also add comments to your script to denote sections, what you are trying to test, etc.... A
comment is started with "//".
Click the "API List" text box and enter an "_" to view a list of the functions you can use to drive
the web browser.

Let's go check out the rest of the Playback tab...
At the top of the tab you have the option telling Sahi where to load the test scripts from.

By default, Sahi loads scripts from the location listed. This directory can be changed via
sahi.properties in the "config" directory

You can share tests across a team by putting the test scripts on a web server instead of copying
the tests to each workstation.

Click the "from url" link at the top of the "Playback" tab
Enter the URL of the test script (e.g. http://www.example.com/Test.sah)
Enter the "Start URL" (e.g. http://www.Google.com/)
Click "Set"

The process should be familiar to you...

At the bottom of the Playback tab you will find:

View Script
View Parsed Script
View Queue
View Logs

Click "View Script" and a copy of the test script currently loaded for play back is displayed in
the web brower.

"View Parsed Script" will display the actual code that will executed by Sahi. This is used for
debugging and is not much use unless you are actively developing Sahi features.

"View Queue" will display the commands being processed by Sahi. Again, this is used for
debugging and is not much use unless you are actively developing Sahi features.

The "View Logs" link is interesting. Clicking it will display a web page with links to the results
of test runs performed by Sahi. The test logs are stored by default in the Sahi "/logs/playback"
directory.

As usual, you can change where Sahi stores the execution logs by modifying sahi.properties in
the "config" directory.



Conclusion

That wraps up the tutorial for Sahi!

You should now know how to:

Install Sahi
Configure your browser to use Sahi
Use Sahi to record scripts
Find page web page elements
Test for success using assertions
View test logs

You are encouraged to review the Sahi API. Sahi provides a robust feature set to assist you in
automating your web application testing efforts.

You are also encouraged to visit the support forum at http://sahi.co.in/forums/index.php for help
and to contribute to the Sahi community.

Good luck!

Contenu connexe

Tendances

AngularJS and SharePoint
AngularJS and SharePointAngularJS and SharePoint
AngularJS and SharePointdanielsmon
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Atirek Gupta
 
Testing Any Site With Cucumber and Selenium
Testing Any Site With Cucumber and SeleniumTesting Any Site With Cucumber and Selenium
Testing Any Site With Cucumber and SeleniumChris Johnson
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008Caleb Jenkins
 
Introduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeopleIntroduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeopleSpringPeople
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
Restful api design
Restful api designRestful api design
Restful api designMizan Riqzia
 
BDD in Java using Cucumber
BDD in Java using CucumberBDD in Java using Cucumber
BDD in Java using Cucumberslavkurochkin
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescueMarko Heijnen
 
ProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsBinary Studio
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development FundamentalsMohammed Makhlouf
 
An approach to app security - For beginners
An approach to app security - For beginnersAn approach to app security - For beginners
An approach to app security - For beginnersvodQA
 
Testing REST Web Services
Testing REST Web ServicesTesting REST Web Services
Testing REST Web ServicesJan Algermissen
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Seleniumvivek_prahlad
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor🌱 Dale Spoonemore
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorFlorian Fesseler
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Andrew Krug
 
Web automation in BDD
Web automation in BDDWeb automation in BDD
Web automation in BDDSandy Yu
 

Tendances (20)

AngularJS and SharePoint
AngularJS and SharePointAngularJS and SharePoint
AngularJS and SharePoint
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Testing Any Site With Cucumber and Selenium
Testing Any Site With Cucumber and SeleniumTesting Any Site With Cucumber and Selenium
Testing Any Site With Cucumber and Selenium
 
ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008ASP.NET AJAX with Visual Studio 2008
ASP.NET AJAX with Visual Studio 2008
 
Introduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeopleIntroduction to Selenium Webdriver - SpringPeople
Introduction to Selenium Webdriver - SpringPeople
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Restful api design
Restful api designRestful api design
Restful api design
 
BDD in Java using Cucumber
BDD in Java using CucumberBDD in Java using Cucumber
BDD in Java using Cucumber
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
ProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applicationsProtractorJS for automated testing of Angular 1.x/2.x applications
ProtractorJS for automated testing of Angular 1.x/2.x applications
 
Web Application Development Fundamentals
Web Application Development FundamentalsWeb Application Development Fundamentals
Web Application Development Fundamentals
 
An approach to app security - For beginners
An approach to app security - For beginnersAn approach to app security - For beginners
An approach to app security - For beginners
 
Selenium
SeleniumSelenium
Selenium
 
Testing REST Web Services
Testing REST Web ServicesTesting REST Web Services
Testing REST Web Services
 
Low-Code Testing Tool
Low-Code Testing ToolLow-Code Testing Tool
Low-Code Testing Tool
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015Selenium Tips & Tricks - StarWest 2015
Selenium Tips & Tricks - StarWest 2015
 
Web automation in BDD
Web automation in BDDWeb automation in BDD
Web automation in BDD
 

En vedette

Sahi Web Automation and Testing Tool
Sahi Web Automation and Testing ToolSahi Web Automation and Testing Tool
Sahi Web Automation and Testing ToolTyto Software
 
Web testing automation with sahi
Web testing automation with sahiWeb testing automation with sahi
Web testing automation with sahiMeraj Khattak
 
Sahi - Effective Web Testing
Sahi - Effective Web TestingSahi - Effective Web Testing
Sahi - Effective Web TestingTyto Software
 
Skybot Application Interfaces: A Critical Tool for Centralizing Job Scheduling
Skybot Application Interfaces: A Critical Tool for Centralizing Job SchedulingSkybot Application Interfaces: A Critical Tool for Centralizing Job Scheduling
Skybot Application Interfaces: A Critical Tool for Centralizing Job SchedulingHelpSystems
 
Learning j meter
Learning j meterLearning j meter
Learning j meterrootucool
 
Introductie at framework
Introductie at frameworkIntroductie at framework
Introductie at frameworkErwin Heitzman
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahiericjamesblackburn
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automationSrikanth Vuriti
 
Getting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & AppiumGetting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & AppiumSauce Labs
 
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...Agile Testing Alliance
 
10 things you didnt know about appium + whats new in appium 1.5
10 things you didnt know about appium + whats new in appium 1.510 things you didnt know about appium + whats new in appium 1.5
10 things you didnt know about appium + whats new in appium 1.5Sauce Labs
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using AppiumMindfire Solutions
 
ATAGTR2017 Test Craftsmanship - From Effectiveness to Greatness
ATAGTR2017 Test Craftsmanship - From Effectiveness to GreatnessATAGTR2017 Test Craftsmanship - From Effectiveness to Greatness
ATAGTR2017 Test Craftsmanship - From Effectiveness to GreatnessAgile Testing Alliance
 
How To Prepare A Basic Training Module
How To Prepare A Basic Training ModuleHow To Prepare A Basic Training Module
How To Prepare A Basic Training ModuleBruhad Buch
 

En vedette (15)

Sahi Web Automation and Testing Tool
Sahi Web Automation and Testing ToolSahi Web Automation and Testing Tool
Sahi Web Automation and Testing Tool
 
Web testing automation with sahi
Web testing automation with sahiWeb testing automation with sahi
Web testing automation with sahi
 
Sahi - Effective Web Testing
Sahi - Effective Web TestingSahi - Effective Web Testing
Sahi - Effective Web Testing
 
Skybot Application Interfaces: A Critical Tool for Centralizing Job Scheduling
Skybot Application Interfaces: A Critical Tool for Centralizing Job SchedulingSkybot Application Interfaces: A Critical Tool for Centralizing Job Scheduling
Skybot Application Interfaces: A Critical Tool for Centralizing Job Scheduling
 
Learning j meter
Learning j meterLearning j meter
Learning j meter
 
Introductie at framework
Introductie at frameworkIntroductie at framework
Introductie at framework
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
Selenium test automation
Selenium test automationSelenium test automation
Selenium test automation
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
 
Getting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & AppiumGetting Started with Mobile Test Automation & Appium
Getting Started with Mobile Test Automation & Appium
 
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
ATAGTR2017 Keeping pace with Product Evolution: UI Automation Framework Guide...
 
10 things you didnt know about appium + whats new in appium 1.5
10 things you didnt know about appium + whats new in appium 1.510 things you didnt know about appium + whats new in appium 1.5
10 things you didnt know about appium + whats new in appium 1.5
 
Android & iOS Automation Using Appium
Android & iOS Automation Using AppiumAndroid & iOS Automation Using Appium
Android & iOS Automation Using Appium
 
ATAGTR2017 Test Craftsmanship - From Effectiveness to Greatness
ATAGTR2017 Test Craftsmanship - From Effectiveness to GreatnessATAGTR2017 Test Craftsmanship - From Effectiveness to Greatness
ATAGTR2017 Test Craftsmanship - From Effectiveness to Greatness
 
How To Prepare A Basic Training Module
How To Prepare A Basic Training ModuleHow To Prepare A Basic Training Module
How To Prepare A Basic Training Module
 

Similaire à Sahi my expirience

Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...webhostingguy
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaSandeep Tol
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkKommunicate Intentive Inc
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-codeNarayana Reddy
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-codeNarayana Reddy
 
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)Prof Ansari
 
Creating & consuming simple web service
Creating & consuming simple web serviceCreating & consuming simple web service
Creating & consuming simple web serviceAbhijit B.
 
Chatting with HIpChat: APIs 101
Chatting with HIpChat: APIs 101Chatting with HIpChat: APIs 101
Chatting with HIpChat: APIs 101colleenfry
 
Build your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automationBuild your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automationWinton Winton
 
How to Redirect HTTP to HTTPS in htaccess.pdf
How to Redirect HTTP to HTTPS in htaccess.pdfHow to Redirect HTTP to HTTPS in htaccess.pdf
How to Redirect HTTP to HTTPS in htaccess.pdfHost It Smart
 
Apache serversideincludes(ssi)inae mpages
Apache serversideincludes(ssi)inae mpagesApache serversideincludes(ssi)inae mpages
Apache serversideincludes(ssi)inae mpagesDeepak Bhardwaj
 
Pipes and Google Mashup Editor
Pipes and Google Mashup EditorPipes and Google Mashup Editor
Pipes and Google Mashup EditorPaul Carvill
 
NZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNick Hadlee
 

Similaire à Sahi my expirience (20)

Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
 
Using HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in JavaUsing HttpWatch Plug-in with Selenium Automation in Java
Using HttpWatch Plug-in with Selenium Automation in Java
 
BBS Sahi Open Source
BBS Sahi Open SourceBBS Sahi Open Source
BBS Sahi Open Source
 
Integration Testing in Python
Integration Testing in PythonIntegration Testing in Python
Integration Testing in Python
 
How to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python FrameworkHow to Create a WhatsApp Chatbot using Flask Python Framework
How to Create a WhatsApp Chatbot using Flask Python Framework
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
 
Share point 2010_overview-day4-code
Share point 2010_overview-day4-codeShare point 2010_overview-day4-code
Share point 2010_overview-day4-code
 
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
DYNAMIC CONTENT TECHNOLOGIES ASP(ACTIVE SERVER PAGES)
 
Ajax & ASP.NET 2
Ajax & ASP.NET 2Ajax & ASP.NET 2
Ajax & ASP.NET 2
 
Creating & consuming simple web service
Creating & consuming simple web serviceCreating & consuming simple web service
Creating & consuming simple web service
 
OPEN STA
OPEN STAOPEN STA
OPEN STA
 
Chatting with HIpChat: APIs 101
Chatting with HIpChat: APIs 101Chatting with HIpChat: APIs 101
Chatting with HIpChat: APIs 101
 
Build your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automationBuild your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automation
 
How to Redirect HTTP to HTTPS in htaccess.pdf
How to Redirect HTTP to HTTPS in htaccess.pdfHow to Redirect HTTP to HTTPS in htaccess.pdf
How to Redirect HTTP to HTTPS in htaccess.pdf
 
Walkthrough asp.net
Walkthrough asp.netWalkthrough asp.net
Walkthrough asp.net
 
Apache serversideincludes(ssi)inae mpages
Apache serversideincludes(ssi)inae mpagesApache serversideincludes(ssi)inae mpages
Apache serversideincludes(ssi)inae mpages
 
Pipes and Google Mashup Editor
Pipes and Google Mashup EditorPipes and Google Mashup Editor
Pipes and Google Mashup Editor
 
CGI Presentation
CGI PresentationCGI Presentation
CGI Presentation
 
NZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePointNZ Code Camp 2011 PowerShell + SharePoint
NZ Code Camp 2011 PowerShell + SharePoint
 
Opr089 xx
Opr089 xxOpr089 xx
Opr089 xx
 

Dernier

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Dernier (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Sahi my expirience

  • 1. Sahi Tutorial Introduction Sahi is an open source testing tool for web applications, with the facility to record and playback scripts. Developed in Javaâ„¢ and Javascript, this tool uses simple Javascript to execute events in the browser. Features: In-browser controls Intelligent recorder Text-based scripts Ant support for playback of suites of tests Multi-threaded playback from a command line HTTP and HTTPS support AJAX support Sahi runs as a proxy server which intercepts traffic from the web browser and records the web browsing actions. Sahi can play back those recorded actions by injecting Javascript into the browser so it can access elements in the web page. This makes the tool independent of the website/ web application. Sahi is similar to Selenium (http://www.openqa.org/selenium-ide/) but is not browser specific like Selenium is. Sahi works with Firefox, Internet Explorer, Opera, and Safari whereas Selenium is Firefox only. In addition, Selenium has to be deployed to the server the web application resides on. Sahi just needs a browser that can display the web application. Sahi is released under the Apache License, Version 2.0. Prerequisites Sahi requires Java 1.4 and above. You can get Java here. Installing Sahi You can download Sahi and the source code from here. The latest build (the one at the top of the list) is the one you want. Unzip sahi.zip to a convenient directory of your choosing. That's it!
  • 2. Running Sahi Navigate to the Sahi directory you extracted and: Windows: Go to bin and run sahi.bat Linux and Mac: Go to /bin and run sahi.sh The Sahi proxy server will start and begin listening for traffic on port 9999. NOTE: by default Sahi uses port 9999. This can be modified through sahi.properties in the config directory. Now that the Sahi proxy server is running, it's time to configure the web browser to use it. Configuring the browser Firefox: Go to Tools > Options > Advanced > Connection Settings > Set to "Manual Proxy Configuration" Set "HTTP Proxy" to "localhost" Set "Port" to "9999". Do the same for "SSL Proxy" too, if you wish to record and playback HTTPS traffic Keep "Use the same proxy for all protocol" unchecked as Sahi does not understand protocols other than HTTP NOTE: "No Proxy for" should NOT have localhost or 127.0.0.1 or the domain of the test application in it. Internet Explorer: Go to Tools > Internet Options > Connections > LAN Settings > In "Proxy server" section, check "Use a proxy server for your LAN" Set "Address" to "localhost" Set "Port" to "9999" Leave "Bypass proxy server for local addresses" unchecked Click OK > OK Opera: Go to Tools > Preferences > Network Click "Proxy servers" button Check "HTTP"
  • 3. Enter localhost in the textbox Enter "9999" for Port Click Ok > Ok Repeat the above if you wish to record and playback HTTPS traffic Safari: Go to Edit > Preferences Select "Advanced" click "Change Settings" for Proxies Click "LAN Settings" button In "Proxy server" section, check "Use a proxy server for your LAN" Set "Address" to "localhost" Set "Port" to "9999" Leave "Bypass proxy server for local addresses" unchecked Click OK > OK Testing with Sahi Now that the Sahi proxy server is running and the web browser is configured to talk to the proxy, it is time to start using Sahi! We'll start out by using Sahi to navigate a webpage: Open http://www.Google.com/ in your web browser After Google loads, hold down the Ctrl and Alt keys and then double-click the web page. The Sahi Controller should now appear:
  • 4. The Sahi Controller has two tabs: Record and Playback. We will start by recording the navigation steps. The "Script Directory" field shows you where the script will be saved. By default Sahi saves to the "scripts" directory. NOTE: This directory can be changed via sahi.properties in the "config" directory. Enter "Test" in the "Script Name" text field and press the "Record" button In the web browser, enter "Sahi" in the Google search box
  • 5. Now click the "Google Search" button Click the "Stop" button in the Sahi Controller So far, so good! Now to play back what we just recorded: Click the "Playback" tab in the Sahi Controller Select "Test.sah" in the "File" selection list Enter "http://www.Google.com/" in the "Start URL" text field Click the "Set" button Wait for the web page in the browser to reload Click the "Play" button
  • 6. The web browser loads the Google search page, "Sahi" is entered in the search box, and the button "Google Search" is clicked. Clicking "Set" loaded the test script and opened the target page for the start of the test. Sahi entered "Shai" into the textbox named "q" using the following statement: _setValue(_textbox("q"), "Sahi"); After the text was entered, Sahi click the submit button labeled "Google Search" with this statement: _click(_submit("Google Search"));
  • 7. And finally Sahi signaled that the test was successful: --Stopped Playback: SUCCESS-- Leave the Google results page open and we'll add a test to find an image on the page.... Click the "Record" tab again Enter "Test" in the "Script Name" text box Click the "Record" button Hold down the "Ctrl" key and move the mouse cursor over the link for "Sahi" in the search results Click the "Assert" button Click the "Text -->" button Click the "Apend to Script" button Finally, click the Stop button
  • 8. Notice that the "Accessor" and "Alternative" fields have been filled in. The "Accessor" indicates that Sahi found the link by the text it contains. The "Alternative" indicates where Sahi found the link in the Document Object Model hierarchy. Clicking the "Assert" button added a condition stating that we believe the link "Sahi" exists on the web page. By clicking the "Test -->" button, we asked Sahi to verify that the link existed. The link did exist and to Sahi answered "true". We added the assert to the script. Let's run the script again with the assert added to it:
  • 9. Success! We are now able to open a web page, fill in a form, submit the form, and test the results. You are encouraged to experiment with setting assertions for different web page elements and testing for them with Sahi scripts. A Closer Look At The Sahi Controller
  • 10. Let's find out what the other buttons on the Record tab do... Open http://www.Google.com/ in the browser again Click the "Record" tab in the Sahi Controller Hold down the "Ctrl" key and hover the mouse over the Google search box. Click the "Props" button in the Sahi Controller The "evaluate expression" box displays the properties of the Google search box. You can expand the Sahi Controller by dragging the corners if you need more reading area. Click the "Hilight" button A red box highlights the search box. This is good technique to use if other people will be using your Sahi scripts so they know what is being tested. In the "Value" text box, enter "Sahi is great" Click the "Set" button The Sahi Controller enters "Sahi" in to the Google search box. Hold down the "Ctrl" key and hover the mouse over the "Google Search" button Click the "Click" button The Sahi Controller clicks the button for you and the browser navigates to the search results. If for some reason you need a Sahi script to pause, you can insert a "Wait" for a specified number of milliseconds (1000 ms = 1 second).
  • 11. You can also add comments to your script to denote sections, what you are trying to test, etc.... A comment is started with "//".
  • 12. Click the "API List" text box and enter an "_" to view a list of the functions you can use to drive the web browser. Let's go check out the rest of the Playback tab...
  • 13. At the top of the tab you have the option telling Sahi where to load the test scripts from. By default, Sahi loads scripts from the location listed. This directory can be changed via sahi.properties in the "config" directory You can share tests across a team by putting the test scripts on a web server instead of copying the tests to each workstation. Click the "from url" link at the top of the "Playback" tab
  • 14. Enter the URL of the test script (e.g. http://www.example.com/Test.sah) Enter the "Start URL" (e.g. http://www.Google.com/) Click "Set" The process should be familiar to you... At the bottom of the Playback tab you will find: View Script View Parsed Script
  • 15. View Queue View Logs Click "View Script" and a copy of the test script currently loaded for play back is displayed in the web brower. "View Parsed Script" will display the actual code that will executed by Sahi. This is used for debugging and is not much use unless you are actively developing Sahi features. "View Queue" will display the commands being processed by Sahi. Again, this is used for debugging and is not much use unless you are actively developing Sahi features. The "View Logs" link is interesting. Clicking it will display a web page with links to the results of test runs performed by Sahi. The test logs are stored by default in the Sahi "/logs/playback" directory. As usual, you can change where Sahi stores the execution logs by modifying sahi.properties in the "config" directory. Conclusion That wraps up the tutorial for Sahi! You should now know how to: Install Sahi Configure your browser to use Sahi Use Sahi to record scripts Find page web page elements Test for success using assertions View test logs You are encouraged to review the Sahi API. Sahi provides a robust feature set to assist you in automating your web application testing efforts. You are also encouraged to visit the support forum at http://sahi.co.in/forums/index.php for help and to contribute to the Sahi community. Good luck!