KEMBAR78
Selenium - Introduction | PDF
Selenium
‫ﺎ‬َ‫ﻧ‬َ‫ﺗ‬ْ‫ﻣ‬‫ﱠ‬‫ﻠ‬َ‫ﻋ‬ ‫ﺎ‬َ‫ﻣ‬ ‫ﱠ‬‫ﻻ‬ِ‫إ‬ ‫ﺎ‬َ‫ﻧ‬َ‫ﻟ‬ َ‫م‬ْ‫ﻠ‬ِ‫ﻋ‬ َ‫ﻻ‬ َ‫ك‬َ‫ﻧ‬‫ﺎ‬َ‫ﺣ‬ْ‫ﺑ‬ُ‫ﺳ‬َ‫ك‬‫ﱠ‬‫ﻧ‬ِ‫إ‬ُ‫م‬‫ﯾ‬ِ‫ﻛ‬َ‫ﺣ‬ْ‫ﻟ‬‫ا‬ ُ‫م‬‫ﯾ‬ِ‫ﻠ‬َ‫ﻌ‬ْ‫ﻟ‬‫ا‬ َ‫ﻧت‬َ‫أ‬
By: Ahmad Naoum
Why Automated Testing?
Manual Testing Automated Testing
Manual testing requires human
intervention for test execution.
Automation Testing is use of tools to
execute test cases
Manual testing will require skilled
labor, long time & will imply high
costs.
Automation Testing saves time, cost
and manpower. Once recorded, it's
easier to run an automated test suite
Any type of application can be tested
manually, certain testing types like
ad-hoc and monkey testing are more
suited for manual execution.
Automated testing is recommended
only for stable systems and is mostly
used for Regression Testing.
Manual testing can be become
repetitive and boring.
The boring part of executing same
test cases time and again, is handled
by automation software in
Automation Testing.
What is Selenium
• Selenium is a free (open source) automated
testing suite for web applications across
different browsers and platforms.
Selenium Components
• Selenium Integrated Development
Environment (IDE)
• Selenium Remote Control (RC)
• WebDriver
• Selenium Grid
Selenium Components Cont.
Who developed Selenium?
• Selenium was originally developed by Jason
Huggins in 2004
• He named this program as the
"JavaScriptTestRunner.“
• He made JavaScriptRunner open-source which
was later re-named as Selenium Core.
The Same Origin Policy Issue
History of Selenium
• In 2004, Paul Hammant developed Selenium
Remote Control (Selenium RC) to solve the same
origin policy issue. This system became known as
the Selenium Remote Control or Selenium 1.
• In 2008, Philippe Hanrigou made Selenium Grid,
allowing running of multiple Selenium tests
concurrently on any number of local or remote
systems, thus minimizing test execution time.
History of Selenium Cont.
• In 2006, Shinya Kasatani of Japan created
Selenium IDE, a Firefox extension that can
automate the browser through a record-and-
playback feature.
• In 2006, Simon Stewart created WebDriver,
which was the first cross-platform testing
framework that could control the browser from
the OS level.
• In 2008, the whole Selenium Team decided to
merge WebDriver and Selenium RC to form a
more powerful tool called Selenium 2.
Why the Name Selenium?
Important Notes
• Selenium WebDriver is termed as the
successor of Selenium RC which has been
deprecated.
• The Selenium IDE for Firefox stopped working
after the Firefox 55 upgrade and will be no
longer maintained.
Components Summary
• Selenium IDE, a Firefox add-on that you can only use in
creating relatively simple test cases and test suites.
• Selenium Remote Control, also known as Selenium 1,
which is the first Selenium tool that allowed users to use
programming languages in creating complex tests.
• WebDriver, the newer breakthrough that allows your test
scripts to communicate directly to the browser, thereby
controlling it from the OS level.
• Selenium Grid is also a tool that is used with Selenium RC
to execute parallel tests across different browsers and
operating systems.
• Selenium RC and WebDriver was merged to form Selenium
2.
Selenium Components
WebDriver Architecture
Some WebDriver Methods
Method Description
void get(String url) Load a new web page in the current
browser window.
String getTitle() The title of the current page.
WebElement findElement(By by) Find the first WebElement using the
given method.
void close() Close the current window, quitting
the browser if it's the last window
currently open.
void quit() Quits this driver, closing every
associated window.
WebDriver.Navigation navigate() An abstraction allowing the driver to
access the browser's history and to
navigate to a given URL.
Some WebElement Methods
Method Description
void click() Click this element.
void sendKeys(CharSequence...
keysToSend)
The title of the current page.
String getText() Get the visible (i.e. not hidden by
CSS) innerText of this element.
isEnabled() Is the element currently enabled or
not? This will generally return true for
everything but disabled input
elements.
void clear() If this element is a text entry
element, this will clear the value.
Gecko Driver
• This program provides the HTTP API described
by the WebDriver protocol to communicate
with Gecko browsers, such as Firefox.
• Gecko Driver Download
https://github.com/mozilla/geckodriver
Selenium First Project Webpage
Create Project and Add Libraries
1. Install JDK
http://www.oracle.com/technetwork/java/javas
e/downloads/jdk8-downloads-2133151.html
2. Install Eclipse
https://www.eclipse.org/downloads/
3. Create a Java Project in Eclipse
4. Add Selenium jars
https://www.seleniumhq.org/download/
5. Add Gecko Driver
Project Implementation Steps
1. Create Project and Add Libraries
2. Launching a Browser Session
3. Read Test Cases From File
4. Run Test Case
5. Validate Output
6. Save Testing Results in File
References
• SeleniumHQ
https://www.seleniumhq.org/
• Selenium WebDriver Java API Docs
https://seleniumhq.github.io/selenium/docs/api/java/
• GURU99 Selenium Tutorial
https://www.guru99.com/selenium-tutorial.html
• GURU99 Manual testing Tutorial
https://www.guru99.com/manual-testing.html
• Wikipedia
https://en.wikipedia.org/wiki/Selenium_%28software
%29
Any Questions

Selenium - Introduction

  • 1.
    Selenium ‫ﺎ‬َ‫ﻧ‬َ‫ﺗ‬ْ‫ﻣ‬‫ﱠ‬‫ﻠ‬َ‫ﻋ‬ ‫ﺎ‬َ‫ﻣ‬ ‫ﱠ‬‫ﻻ‬ِ‫إ‬‫ﺎ‬َ‫ﻧ‬َ‫ﻟ‬ َ‫م‬ْ‫ﻠ‬ِ‫ﻋ‬ َ‫ﻻ‬ َ‫ك‬َ‫ﻧ‬‫ﺎ‬َ‫ﺣ‬ْ‫ﺑ‬ُ‫ﺳ‬َ‫ك‬‫ﱠ‬‫ﻧ‬ِ‫إ‬ُ‫م‬‫ﯾ‬ِ‫ﻛ‬َ‫ﺣ‬ْ‫ﻟ‬‫ا‬ ُ‫م‬‫ﯾ‬ِ‫ﻠ‬َ‫ﻌ‬ْ‫ﻟ‬‫ا‬ َ‫ﻧت‬َ‫أ‬ By: Ahmad Naoum
  • 2.
    Why Automated Testing? ManualTesting Automated Testing Manual testing requires human intervention for test execution. Automation Testing is use of tools to execute test cases Manual testing will require skilled labor, long time & will imply high costs. Automation Testing saves time, cost and manpower. Once recorded, it's easier to run an automated test suite Any type of application can be tested manually, certain testing types like ad-hoc and monkey testing are more suited for manual execution. Automated testing is recommended only for stable systems and is mostly used for Regression Testing. Manual testing can be become repetitive and boring. The boring part of executing same test cases time and again, is handled by automation software in Automation Testing.
  • 3.
    What is Selenium •Selenium is a free (open source) automated testing suite for web applications across different browsers and platforms.
  • 4.
    Selenium Components • SeleniumIntegrated Development Environment (IDE) • Selenium Remote Control (RC) • WebDriver • Selenium Grid
  • 5.
  • 6.
    Who developed Selenium? •Selenium was originally developed by Jason Huggins in 2004 • He named this program as the "JavaScriptTestRunner.“ • He made JavaScriptRunner open-source which was later re-named as Selenium Core.
  • 7.
    The Same OriginPolicy Issue
  • 8.
    History of Selenium •In 2004, Paul Hammant developed Selenium Remote Control (Selenium RC) to solve the same origin policy issue. This system became known as the Selenium Remote Control or Selenium 1. • In 2008, Philippe Hanrigou made Selenium Grid, allowing running of multiple Selenium tests concurrently on any number of local or remote systems, thus minimizing test execution time.
  • 9.
    History of SeleniumCont. • In 2006, Shinya Kasatani of Japan created Selenium IDE, a Firefox extension that can automate the browser through a record-and- playback feature. • In 2006, Simon Stewart created WebDriver, which was the first cross-platform testing framework that could control the browser from the OS level. • In 2008, the whole Selenium Team decided to merge WebDriver and Selenium RC to form a more powerful tool called Selenium 2.
  • 10.
    Why the NameSelenium?
  • 11.
    Important Notes • SeleniumWebDriver is termed as the successor of Selenium RC which has been deprecated. • The Selenium IDE for Firefox stopped working after the Firefox 55 upgrade and will be no longer maintained.
  • 12.
    Components Summary • SeleniumIDE, a Firefox add-on that you can only use in creating relatively simple test cases and test suites. • Selenium Remote Control, also known as Selenium 1, which is the first Selenium tool that allowed users to use programming languages in creating complex tests. • WebDriver, the newer breakthrough that allows your test scripts to communicate directly to the browser, thereby controlling it from the OS level. • Selenium Grid is also a tool that is used with Selenium RC to execute parallel tests across different browsers and operating systems. • Selenium RC and WebDriver was merged to form Selenium 2.
  • 13.
  • 14.
  • 15.
    Some WebDriver Methods MethodDescription void get(String url) Load a new web page in the current browser window. String getTitle() The title of the current page. WebElement findElement(By by) Find the first WebElement using the given method. void close() Close the current window, quitting the browser if it's the last window currently open. void quit() Quits this driver, closing every associated window. WebDriver.Navigation navigate() An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
  • 16.
    Some WebElement Methods MethodDescription void click() Click this element. void sendKeys(CharSequence... keysToSend) The title of the current page. String getText() Get the visible (i.e. not hidden by CSS) innerText of this element. isEnabled() Is the element currently enabled or not? This will generally return true for everything but disabled input elements. void clear() If this element is a text entry element, this will clear the value.
  • 17.
    Gecko Driver • Thisprogram provides the HTTP API described by the WebDriver protocol to communicate with Gecko browsers, such as Firefox. • Gecko Driver Download https://github.com/mozilla/geckodriver
  • 18.
  • 19.
    Create Project andAdd Libraries 1. Install JDK http://www.oracle.com/technetwork/java/javas e/downloads/jdk8-downloads-2133151.html 2. Install Eclipse https://www.eclipse.org/downloads/ 3. Create a Java Project in Eclipse 4. Add Selenium jars https://www.seleniumhq.org/download/ 5. Add Gecko Driver
  • 20.
    Project Implementation Steps 1.Create Project and Add Libraries 2. Launching a Browser Session 3. Read Test Cases From File 4. Run Test Case 5. Validate Output 6. Save Testing Results in File
  • 21.
    References • SeleniumHQ https://www.seleniumhq.org/ • SeleniumWebDriver Java API Docs https://seleniumhq.github.io/selenium/docs/api/java/ • GURU99 Selenium Tutorial https://www.guru99.com/selenium-tutorial.html • GURU99 Manual testing Tutorial https://www.guru99.com/manual-testing.html • Wikipedia https://en.wikipedia.org/wiki/Selenium_%28software %29
  • 22.