Presentation is loading. Please wait.

Presentation is loading. Please wait.

Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.

Similar presentations


Presentation on theme: "Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel."— Presentation transcript:

1 Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel

2 2 Day 10 Selenium 2 (WebDriver)

3  Selenium is a test automation framework that interacts with a browser via javascript  WebDriver is a test automation framework that interacts with the browser directly  Selenium 2 is the merging of the Open Source "selenium" and "webdriver" projects The most recent release is Selenium 2.46.0.

4  Install selenium webdriver client: ◦ In PyCharm select Settings > Python Interpreter ◦ Click on the plus (+) icon to add an additional python package ◦ Search for 'selenium', select and click Install Installation is Complete!  To use basic webdriver commands: ◦ In you python TestCase import webdriver from selenium import webdriver ◦ Create a webdriver browser instance self.driver = webdriver.Firefox() ◦ Use the object instance to find elements and perform actions self.driver.find_element_by_id("Submit").click()

5  Firefox  Opera  Chrome  Ie  Safari  PantomJS  Remote  Android **  Blackberry ** ** = Deprecated

6 Webdriver API Documentation: herehere CommandDefinition get opens a specified URL title returns the page title find_element_by_* returns first found matching element. Options include: id, tag_name, class_name, link_text, partial_link_text, css_selector, xpath and name find_elements_by_* returns ALL found matching elements. Options include: id, tag_name, class_name, link_text, partial_link_text, css_selector, xpath and name execute_script Executes specified javascript code within the browser window current_url returns current window URL page_source return html source of the page close closes the current window quit quits the browser session current_window_handle returns the window handle of the currently selected window

7 Webdriver API Documentation: herehere CommandDefinition window_handles returns a list of window handles of all windows belonging to the browser session maximize_window maximize window switch_to Switch from current document to another window or frame. Often user in conjunction with window_handles switch_to_default_content Switch to the original document switch_to_alert Switch to alert back, forward, refresh Back to previous page, forward to next page, refresh current page get_cookies returns all stored cookies for the current domain in the current session get_cookie Retrieve the value of a specific cookie by name delete_cookie Delete a specific cookie by name delete_all_cookies Delete ALL cookies for the current domain or the current session add_cookie Add a cookies (name and value pair)

8 Webdriver API Documentation: herehere CommandDefinition implicitly_wait time to continue looking for an element find_element less commonly use implementation to locate first matching web element find_elements less commonly use implementation to locate ALL matching web elements get_screenshot_as_file Capture a screenshot get_screenshot_as_png Alternative way to capture a screenshot set_window_size Configure specific window size get_window_size returns current window size in pixels set_window_position Set the position of the top left corner of the window get_window_position returns the position of the top left corner of the window

9 CommandDescription tag_name Click this element. text returns element's visible text click performs a single click submit submits a form (similar to pressing enter/return on the keyboard) clear clears all content from a field get_attribute returns value of a webelement attribute is_selected returns true/false based on webelement's (checkbox, radio button) selection is_enabled returns true/false based on webelement's write-ability

10 CommandDescription find_element_by_* returns first found matching element. Options include: id, tag_name, class_name, link_text, partial_link_text, css_selector, xpath and name find_elements_by_* returns ALL found matching elements. Options include: id, tag_name, class_name, link_text, partial_link_text, css_selector, xpath and name send_keys Simulates entering text into a field is_displayed returns true/false based on webelement's visibility location_once_scroll ed_into_view returns coordinates of the top left corner of the element, once it has been scrolled into view size returns width and height of the element in pixals location returns coordinates of the top left corner of the element id returns the value of the id attribute of the current element (read only)


Download ppt "Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel."

Similar presentations


Ads by Google