code: def _find_web_element(self):
          
          if not self._web_element or not self.config.getboolean_optional('Driver', 'save_web_element'):
              # If the element is encapsulated we use the shadowroot tag in yaml (eg. Shadowroot: root_element_name)
              if self.shadowroot:
                  if self.locator[0] != By.CSS_SELECTOR:
                      raise Exception('Locator type should be CSS_SELECTOR using shadowroot but found: '
                                      '%s'.format(self.locator[0]))
                  # querySelector only support CSS SELECTOR locator
                  self._web_element = self.driver.execute_script('return document.querySelector("%s").shadowRoot.'
                                                                 'querySelector("%s")' % (self.shadowroot,
                                                                                          self.locator[1]))
              else:
                  # Element will be finded from parent element or from driver
                  base = self.utils.get_web_element(self.parent) if self.parent else self.driver
                  # Find elements and get the correct index or find a single element
                  self._web_element = base.find_elements(*self.locator)[self.order] if self.order else base.find_element(
                      *self.locator)
docs: Find WebElement using element locator and save it in _web_element attribute