def click(locationType, locatorExpression, *arg): # 单击页面元素 global driver try: getElement(driver, locationType, locatorExpression).click() except Exception as e: raise e
def clear(loctaionType, locatiorExpression, *arg): # 清除输入框默认内容 global driver try: getElement(driver, loctaionType, locatiorExpression).clear() except Exception as e: raise e
def input_string(locationType, locatorExpression, inputContent): # 在页面输入框中输入数据 global driver try: getElement(driver, locationType, locatorExpression).send_keys(inputContent) # print(inputContent) except Exception as e: raise e
def switch_to_frame(locationType, framelcoatorExpression, *arg): global driver try: driver.switch_to.frame(getElement(driver, locationType, framelcoatorExpression)) except Exception as e: print("frame error") raise e
def waitFrameToBeAvailableAndSwitchToIt(locationType, locatorExprexxion, *args): # 检查frame 是否存在,存在则切换进frame控件中 global driver try: driver.switch_to.frame( getElement(driver, locationType, locatorExprexxion)) except Exception as e: # print("error...") raise e
def input_string(loctionType, locatorExpression, inputContent): global driver try: # if not str(inputContent).find(".")==-1: # inputContent0,NONE=(inputContent).split(".") # if NONE.str.isdigit(): # getElement(driver, loctionType, locatorExpression).send_keys(inputContent0) # else: # getElement(driver, loctionType, locatorExpression).send_keys(inputContent) # else: # getElement(driver, loctionType, locatorExpression).send_keys(inputContent) if str(inputContent).find(".") > 0: inputContent0, NONE = str(inputContent).split(".") if NONE.isdigit(): getElement(driver, loctionType, locatorExpression).send_keys(inputContent0) else: getElement(driver, loctionType, locatorExpression).send_keys(inputContent) else: getElement(driver, loctionType, locatorExpression).send_keys(inputContent) except Exception as e: raise e