6 examples of 'find_element_by_' in Python

Every line of 'find_element_by_' 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

6@staticmethod
7def id(by_id):
8 return Selenium_By.ID, by_id
18def finder(driver):
19 element = driver.find_element_by_class_name(element_class)
20 assert element.size['width'] == width
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)
18@staticmethod
19def link_text(link_text):
20 return Selenium_By.LINK_TEXT, link_text
54def find_by_text(self, tag, text):
55 return self.wait_until_visible((By.XPATH,"//" + tag + "[contains(.,'" + text + "')]"))

Related snippets