def get_element(self,locator): #这个传进去的locator是一个元组(By.NAME,"username") ''' 根据表达式匹配单个元素 :param locator: :return: ''' waitEle(self.driver,TIMEOUT,POLL_FREQUENCY,locator) # 返回元素对象, 元组传参 # *locator是两个变量。By.NAME "username" 所以driver.find_element(*locator) 的意思就是driver.find_element(By.NAME,"username") return self.driver.find_element(*locator)
事例: