# 通讯录页面，点击添加成员
from appium.webdriver.common.mobileby import MobileBy

from homework_zfh.test_appium.page.BasePage import BasePage
from homework_zfh.test_appium.page.memberinvite_page import MemberInvitePage


class ContactPage(BasePage):
    def click_addmember(self):
        # 点击添加成员
        element = (MobileBy.ANDROID_UIAUTOMATOR,
                   'new UiScrollable(new UiSelector().'
                   'scrollable(true).instance(0)).'
                   'scrollIntoView(new UiSelector().'
                   'text("添加成员").instance(0));')
        self.find(element).click()
        # self.find((MobileBy.XPATH, "//*[@text='添加成员']")).click()
        return MemberInvitePage(self.driver)
