Eli Lu 20161013 Outline What is selenium Selenium Projects Selenium Sponsors Easy to use Useful Feature amp Tools Useful Links Q amp A What is selenium What is selenium Selenium ID: 635332
Download Presentation The PPT/PDF document "Introduction of Selenium" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Introduction of Selenium
Eli Lu
2016/10/13Slide2
Outline
What is selenium ?
Selenium Projects
Selenium Sponsors
Easy to use
Useful Feature & Tools
Useful Links
Q & A Slide3
What is selenium ?
What is selenium ?
Selenium
automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
Support languages
Java ,
csharp
, python, ruby ,
php
,
perl
,
javascript
,
golang
Slide4
Selenium Projects
Selenium
WebDriver
Selenium
WebDriver
can drive a browser natively either locally or on remote machines.
Selenium Grid Selenium Grid takes Selenium Remote Control to another level by running tests on many servers at the same time, cutting down on the time it takes to test multiple browsers or operating systems.Selenium IDESelenium IDE is a Firefox add-on that makes it easy to record and playback tests in Firefox 2+. You can even use it to generate code to run the tests with Selenium Remote Control.Selenium Remote Control Selenium Remote Control is a client/server system that allows you to control web browsers locally or on other computers, using almost any programming language and testing frameworkSlide5
Selenium Sponsors
Selenium-Level Sponsors
Platinum-Level Sponsors
HC360000
USEDSlide6
Easy to Use Slide7
Useful Feature & Method
Class of Selenium::
WebDriver
::
Find_Element
(s)
By Class, Class Name
:
Class Name
By CSS
:
CSS Selector
By ID
:
ID
By Link : Link
By Link Text,
Partial Link
Text
:
Link Text
By Name ,Tag Name : Name & Tag Name
By XPATH : XPATH
Class of Selenium::
WebDriver
::Navigation
b
ack
: Move back a single entry in the browser's history.
f
orward
: Move forward a single entry in the browser's history.
i
nitialize
: A new instance of Navigation.
r
efresh
: Refresh the current page.
to
: Navigate to the given URL.Slide8
Class of Selenium::
WebDriver
::Element
attribute
: Get the value of the given attribute.
clear
: Clear this element.
click : Click the element.displayed? : Is the element displayed?.enabled? : Is the element enabled?.send_key : Send keystrokes to this element.text : Get the text content of this element.value
: Get the value of this element.Screenshot feature of Selenium::WebDriver
save_screenshot : save screenshot to PNG file screenshot_as : save screenshot as specific format
Base64 or pngSlide9
Get XPATH from chrome browser
Launch Chrome
Enable Developer Tool
Find target element
Press right click
Select Copy
Select Copy XPATH
Take full screenshot at chrome require “
chromedriver-screenshot”Add implicit timeouts wait
driver.manage.timeouts.implicit_wait
= 30Slide10
Set Wait time & use
wait.until
wait
= Selenium::
WebDriver
::
Wait.new(:timeout => 60) # seconds
wait.until
{ driver.find_elements
(:xpath => "//*[@id='Email']" )
}
Scroll to specific element
element
.
location_once_scrolled_into_view
Find Element Memo
Find element’s parent
(:
xpath
=> "../
ol
/li
")
Find by content of tag
(:
xpath
=> "//h3[contains(text
(),‘Yahoo')]")
Find element from element
rootElement.find_element
(:
xpath
=> “//h3/h4”)
childElement
=
rootElement.find_element
(:
xpath
=> “/h5/h6”)
Find element by attribute value
(:
xpath
=> "//*[@id='
signIn
']")Slide11
Useful Links
Selenium Website
http://docs.seleniumhq.org
/
Ruby Bindings
https://
github.com/SeleniumHQ/selenium/wiki/Ruby-BindingsSelenium API Document for Ruby http://www.rubydoc.info/gems/selenium-webdriver/0.0.28/Selenium/WebDriver/DriverRuby Website https://www.ruby-lang.org/zh_tw/ Example of Eli Lu
https://github.com/luyaotsung/CompanyWorkJobs/blob/master/Ruby/AndroidDeveloperConsole.rb Slide12
Q & A