Posts

Showing posts with the label locators

Selenium - locators

Image
Selenium Locators are used for identifying the web elements on the web page. T o access the HTML elements from a web page locators are used. In Selenium, we can use locators to perform actions on text boxes, checkboxes, links, radio buttons, list boxes, and other web elements. Locators help us in identifying the objects. This tutorial explains different types of locators, how, when, and ideal Strategies to use these locators. Example of web browser methods: Find Element by: There are two private methods that might be useful for locating page elements: find_element find_elements Example usage: from selenium.webdriver.common.by import By driver . find_element ( By . XPATH , '//button[text()="Some text"]' ) driver . find_elements ( By . XPATH , '//button' ) These are the attributes available for  By  class: ID = "id" XPATH = "xpath" LINK_TEXT = "link text" PARTIAL_LINK_TEXT = "partial link text" NAME ...