Ejemplo n.º 1
0
def step_impl(context):
    address = context.table[0]['address']
    o_result = context.table[0]['o_result']

    search_key = Navi().get_navi_search_key_ele()
    if search_key.wait.exists():
        search_key.set_text(Utils().unicode_input(address))
    else:
        Utils().raise_Exception_info('搜索框控件不存在')

    list_item = Navi().get_navi_search_addr_list_title()

    if list_item.wait.exists(timeout=Utils().LONG_TIME_OUT):
        size = len(list_item)
        idx = random.randint(0, size - 1)
        e = list_item[idx]
        ret = e.text.strip()
        e.click.wait()
        # 返回选择的地址并存入上下文
        Utils().set_context_map(o_result, ret)
    else:
        Utils().raise_Exception_info('没有搜索到对应的城市')
Ejemplo n.º 2
0
def step_impl(context):
    city_name = context.table[0]['city_name']

    city_search = Navi().get_navi_search_city_bar_ele()
    # 点击城市控件
    if city_search.wait.exists():
        city_search.click.wait()
    else:
        Utils().raise_Exception_info('搜索城市控件不存在')

    search_key = Navi().get_navi_search_key_ele()
    if search_key.wait.exists():
        search_key.set_text(Utils().unicode_input(city_name))
    else:
        Utils().raise_Exception_info('搜索框控件不存在')
    # 搜索列表
    list_item = Navi().get_navi_search_city_list_item()
    if list_item.wait.exists(timeout=Utils().LONG_TIME_OUT):
        for e in list_item:
            if e.text.strip() == city_name:
                e.click.wait()
                break
    else:
        Utils().raise_Exception_info('没有搜索到对应的城市')