10 examples of 'driver.find_element' in Python

Every line of 'driver.find_element' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
5def find_element(driver, locator):
6 return WebDriverWait(driver, 2).until(
7 EC.presence_of_element_located(locator))
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

54def find_by_text(self, tag, text):
55 return self.wait_until_visible((By.XPATH,"//" + tag + "[contains(.,'" + text + "')]"))
179def _find_element():
180 try:
181 try:
182 element["inner"] = DynamicElement(self, self._selenium_context().find_element(by, value), locator, identifier)
183 return element["inner"]
184 except (exceptions.NoSuchElementException, StaleElementReferenceException):
185 # Only Element can reach here
186 self.wait_for().exists()
187 element["inner"] = DynamicElement(self, self._selenium_context().find_element(by, value), locator, identifier)
188 return element["inner"]
189 except InvalidSelectorException:
190 raise exceptions.InvalidLocatorException("The value <%s> of locator <%s> is not a valid expression." % (value, locator), self)
191 except NoSuchElementException:
192 element["inner"] = None
193 return element["inner"]
194 except WebDriverException as wde:
195 raise exceptions.EasyiumException(wde.msg, self)
18def finder(driver):
19 element = driver.find_element_by_class_name(element_class)
20 assert element.size['width'] == width
536def _element_input_text_by_locator(self, locator, text):
537 try:
538 element = self._element_find(locator, True, True)
539 element.send_keys(text)
540 except Exception as e:
541 raise e
48def is_element_visible(self, element_selector):
49 raise NotImplementedError
501def find_option_by_text(self, text):
502 return self.find_by_xpath(
503 '//option[normalize-space(text())="%s"]' % text,
504 original_find="option by text",
505 original_query=text,
506 )
90def select_option_by_value(self, element_selector, value):
91 raise NotImplementedError
78def _find_element_by_id(self, element_id, driver=None, timeout=5):
79 driver = driver or self._driver
80 return WebDriverWait(driver, timeout, poll_frequency=self._poll_frequency).until(
81 EC.visibility_of_element_located((By.ID, element_id))
82 )
18@staticmethod
19def link_text(link_text):
20 return Selenium_By.LINK_TEXT, link_text

Related snippets