def Set(cls, value):
if value == "":
return
if value == "SET_EMPTY":
value = ""
log.step_normal(u"Element [%s]: Set Value [%s]." % (cls.__name__, value))
# cls.__wait()
WebDriverWait(env.driver, 10).until(lambda the_driver:
the_driver.find_element(cls.by, cls.value).is_displayed())
elements = env.driver.find_elements(cls.by, cls.value)
if elements[cls.index].tag_name == "select" or elements[cls.index].tag_name == "ul":
cls.Select(value)
time.sleep(3)
else:
elements[cls.index].clear()
action = webdriver.ActionChains(env.driver)
action.send_keys_to_element(elements[cls.index], value)
action.perform()
time.sleep(3)
cls.__clearup()
评论列表
文章目录