SeldomQA / poium

Page Objects design pattern test library, support selenium、appium、playwright, etc
https://pypi.org/project/poium
Apache License 2.0
416 stars 140 forks source link

虫师,wait和find写反了吧 #1

Closed liang1vs1 closed 5 years ago

liang1vs1 commented 5 years ago
def wait(self, context):
    try:
        return context.find_element(*self.locator)
    except NoSuchElementException:
        return None

def find(self, context):
    for i in range(self.time_out):
        if self.wait(context) is not None:
            return self.wait(context)
        else:
            sleep(1)
    else:
        return None
defnngj commented 5 years ago

wait()find() 为内部方法,在命名上欠妥,wait() 改为 get_element()较为合适,不过,这并不影响使用。