Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction of Selenium Eli Lu 2016/10/13. Outline What is selenium ? Selenium Projects Selenium Sponsors Easy to use Useful Feature & Tools Useful Links.

Similar presentations


Presentation on theme: "Introduction of Selenium Eli Lu 2016/10/13. Outline What is selenium ? Selenium Projects Selenium Sponsors Easy to use Useful Feature & Tools Useful Links."— Presentation transcript:

1 Introduction of Selenium Eli Lu 2016/10/13

2 Outline What is selenium ? Selenium Projects Selenium Sponsors Easy to use Useful Feature & Tools Useful Links Q & A

3 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

4 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 IDE – Selenium 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 framework

5 Selenium Sponsors Selenium-Level Sponsors Platinum-Level Sponsors HC360000 USED

6 Easy to Use Setup Environment Select OS Select Language Select Browser Install Selenium Install Language Install Browser Execute Sample Code Download Source Execute Modify for your purpose Use Firefox to get element Set event for each element Debug

7 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 – back : Move back a single entry in the browser's history. – forward : Move forward a single entry in the browser's history. – initialize : A new instance of Navigation. – refresh : Refresh the current page. – to : Navigate to the given URL.

8 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 png

9 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 = 30

10 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']")

11 Useful Links Selenium Website – http://docs.seleniumhq.org/ http://docs.seleniumhq.org/ Ruby Bindings – https://github.com/SeleniumHQ/selenium/wiki/Ruby- Bindings https://github.com/SeleniumHQ/selenium/wiki/Ruby- Bindings Selenium API Document for Ruby – http://www.rubydoc.info/gems/selenium- webdriver/0.0.28/Selenium/WebDriver/Driver http://www.rubydoc.info/gems/selenium- webdriver/0.0.28/Selenium/WebDriver/Driver Ruby Website – https://www.ruby-lang.org/zh_tw/ https://www.ruby-lang.org/zh_tw/ Example of Eli Lu – https://github.com/luyaotsung/CompanyWorkJobs/blob/ master/Ruby/AndroidDeveloperConsole.rb https://github.com/luyaotsung/CompanyWorkJobs/blob/ master/Ruby/AndroidDeveloperConsole.rb

12 Q & A


Download ppt "Introduction of Selenium Eli Lu 2016/10/13. Outline What is selenium ? Selenium Projects Selenium Sponsors Easy to use Useful Feature & Tools Useful Links."

Similar presentations


Ads by Google