-
Notifications
You must be signed in to change notification settings - Fork 29
Finding Elements
v 0.1.5414.25590 or higher
Use this when you know AutomationProperties.AutomationId attribute of an element.
driver.find_element_by_id('SearchBar')
Use this when you know AutomationProperties.Name attribute of an element.
driver.find_element_by_name('AddressLabel')
Before 0.1.5414.25590 name strategy used
Name
property, notAutomationProperties.Name
Use this when you want to locate an element by its class name (complete with namespace).
driver.find_element_by_tag_name('System.Windows.Controls.TextBlock')
Transitional. To be depricated. Use this when you want to locate an element by its Name property (NOT AutomationProperties.Name). Not recomended. Add AutomationProperties.Name
to the element you are planning to use in test and use name strategy instead.
from selenium.webdriver.common.by import By
By.XNAME = 'xname' # enable xname as valid By strategy
...
driver.find_elements('xname', 'Title')