BrowserTab.find_element

def find_element(
self,
locator: Union[_Locator, str],
locator_variables: dict = {}
) -> WebElement

Return the Web element defined by the given locator.

Remarks:
Use the following method, BrowserTab.find_element is different with the method clicknium.find_element when locating the UI element.

  • clicknium.find_element() is for both web and window UI element, and is not limited to a specific scope.
  • clicknium.chrome.open("https://bing.com").find_element() will locate the element in its parent web page.

Parameters:
locator[Required]: str | _Locator
   locator string, the visit path of locator for target UI element, eg: ‘locator.chrome.bing.search_sb_form_q’, locator store is chrome, and locator name is search_sb_form_q. For more details, please refer to Locator.
locator_variables: dict
   locator variables, set to initialize parameters in locator, eg: { "row": 1, "column": 1}, more about variables, please refer to Parametric Locator.

Returns:
WebElement object.

Example:


from clicknium import clicknium as cc, locator

chrome_tab = cc.chrome.open("https://bing.com")

# find element
webelement = chrome_tab.find_element(locator.chrome.bing.search_sb_form_q)

# parametric locator
variables = {"name":"test"}
webelement = chrome_tab.find_element(locator.chrome.bing.search_sb_form_q, variables)

PreviousscrollNextfind_element_by_xpath

What are your feelings
Updated on 29 August 2023