def __init__(self, webElement): ''' 初始化类,参数说明如下: :param webElement: 该控件关联文本框的ID(根据开发提供,所有控件必须操作ID) ''' #初始化继承类 Select.__init__(self,webElement)
def __init__(self, driver, componentID): ''' 初始化类,参数说明如下: :param driver: 提供页面操作句柄,该句柄必须来自于webdriver :param componentID: 该控件关联文本框的ID(根据开发提供,所有控件必须操作ID) ''' # 判定driver的合法性,是否为webdriver if type(driver) is webdriver.chrome.webdriver.WebDriver: self.driver = driver self.componentID = str(componentID) self.selectElement = self.driver.find_element_by_id( self.componentID) # 还需判定元素的存在性 else: raise Exception("driver类型错误:非webdriver类型") #webelement=driver.find_element_by_id(componentID) Select.__init__(self.selectElement)
def __init__(self): super(_SelectMixin, self).__init__(self.element) Select.__init__(self, self.element)
def __init__(self, webelement): # WebElementWrapper is created by coping __dict__ of WebElement instance #+ in method __new__ of _WebElementWrapper. So there have to be called #+ only init method of Select. Select.__init__(self, webelement)