zoukankan      html  css  js  c++  java
  • 封装的隐示等待方法

    #第一步:确定元素的定位表达式,这个是一个元组的格式,
    invalid_msg_locator=("xpath", '//div[@class="layui-layer-content"]')#不输入密码错误的的提示信



    #第二步:写一个方法封装隐示等待方法
    # locator:tuple声明是一个元组
    def wait_element_visible(self,locator:tuple):
    #等待某个元素可见
    wait = WebDriverWait(self.driver,timeout=20, poll_frequency=0.2)
    e = wait.until(expected_conditions.visibility_of_element_located(locator))
    return e


    #第三步:调用隐示方法,让元素可见
    def get_error_msg(self):
    """获取错误信息"""
    e = self.wait_element_visible(self.error_msg_locator)传元素定位,不要加星号,这里不需要拆包
    return e.text 千万不要加星号,会报错的




  • 相关阅读:
    hdu 3018
    poj 1833 排列
    poj 1256 Anagram
    CF 548B Mike and Fun
    CF 548A
    【冰茶几专题】F
    【冰茶几专题】C
    535 C.Tavas and karafs
    [WA]cf 534 D. Handshakes
    cf 534C. Polycarpus' Dice
  • 原文地址:https://www.cnblogs.com/nitingyue/p/13322795.html
Copyright © 2011-2022 走看看