Advertisement
ridwan100

element

Jan 17th, 2023
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. from selenium.webdriver.common.by import By
  2. from selenium.webdriver.support.ui import WebDriverWait
  3.  
  4.  
  5. class BasePageElement(object):
  6.     def __set__(self,obj,value):
  7.         driver = obj.driver
  8.         WebDriverWait(driver,100).until(
  9.             lambda driver:driver.find_element(By.NAME,self.locator))
  10.         driver.find_element(By.NAME,self.locator).clear()
  11.         driver.find_element(By.NAME,self.locator).send_keys(value)
  12.     def __get__(self,obj,owner):
  13.        
  14.         driver = obj.driver
  15.         WebDriverWait(driver,100).until(
  16.             lambda driver:driver.find_element(By.NAME,self.locator))
  17.         element = driver.find_element(By.NAME,self.locator)
  18.         return element.get_attribute('value')
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement