Exemplo n.º 1
0
class shopping_bag(object):
    def __init__(self, driver):
        self.driver = driver
        self.file_path = os.path.join(os.getcwd() + "/config/" +
                                      "shopping_bag.ini")
        self.sb = FindElement(self.driver,
                              file_path=self.file_path,
                              node="shopping_bag")

    def get_text(self):
        try:
            text = self.sb.get_element("text").text
            return text
        except:
            return None

    def click_go_shopping_button(self):
        self.sb.get_element("go_to_shop_button")

    def get_shop_title(self):
        try:
            text = self.sb.get_element("shop_title").text
            return text
        except:
            return None
Exemplo n.º 2
0
class Home_page(object):
    def __init__(self, driver):
        self.driver = driver
        self.file_path = os.path.join(os.getcwd() + "/config/" +
                                      "home_page_element.ini")
        self.home_page = FindElement(self.driver,
                                     file_path=self.file_path,
                                     node="home_page")

    # into three button
    def click_button(self, button):
        self.home_page.get_element(button).click()
        return self.get_title_name()

    # return title name
    def get_title_name(self):
        try:
            time.sleep(2)
            text = self.home_page.get_element("title_name").text
            print(text)
            return text
        except:
            return None

    # into product detail
    def click_product_button(self, element):
        T = True
        while T:
            try:
                self.home_page.get_element(element).click()
                T = False
                return self.get_product_detail_page_title()
            except:
                self.home_page.scroll_get_element(element)

    # get product product detail page title
    def get_product_detail_page_title(self):
        try:
            time.sleep(2)
            text = self.home_page.get_element("product_detail_text").text
            return text
        except:
            return None

    def click_seller_tabber(self):
        self.home_page.get_element("seller_tabber").click()
        return self.get_seller_page_title()

    def get_seller_page_title(self):
        try:
            time.sleep(2)
            text = self.home_page.get_element("seller_header").text
            return text
        except:
            return None
Exemplo n.º 3
0
class class_list(object):
    def __init__(self, driver):
        self.driver = driver
        self.file_path = os.path.join(os.getcwd() + "/config/" +
                                      "class_element.ini")
        self.cl = FindElement(self.driver,
                              file_path=self.file_path,
                              node="class_list")

    def click_class_1(self):
        self.cl.get_element("class_1").click()

    def click_class_2(self):
        self.cl.get_element("class_2").click()

    def get_sorting_text(self):
        try:
            time.sleep(2)
            text = self.cl.get_element("sorting_text").text
            if text == "综合排序":
                return True
            else:
                return False
        except:
            return False

    def click_QR_tabber(self):
        try:
            self.cl.get_element("QR_code").click()
            time.sleep(2)
            text = self.cl.get_element("title_text").text
            if text == "分 享":
                return True
            else:
                return False
        except:
            return False
Exemplo n.º 4
0
class Home_page(object):
    def __init__(self, driver):
        self.driver = driver
        self.file_path = os.path.join(os.getcwd() + "/config/" +
                                      "home_page_element.ini")
        self.home_page = FindElement(self.driver,
                                     file_path=self.file_path,
                                     node="home_page")

    def click_button(self, button):
        if button == "brand_story":
            self.click_brand_story()
        elif button == "sharing_rule":
            self.click_sharing_rule()
        elif button == "business_academy":
            self.click_business_academy()
        elif button == "sleep_channel":
            self.click_sleep_channel()
        elif button == "product_world":
            self.click_product_world()
        elif button == "cant_test":
            self.click_cant_test()
        elif button == "switch_class":
            self.click_switch_class()

    def click_brand_story(self):
        self.home_page.get_element("brand_story").click()

    def click_sharing_rule(self):
        self.home_page.get_element("sharing_rule").click()

    def click_business_academy(self):
        self.home_page.get_element("business_academy").click()

    def click_sleep_channel(self):
        self.home_page.get_element("sleep_channel").click()

    def click_product_world(self):
        self.home_page.get_element("product_world").click()

    def click_cant_test(self):
        self.home_page.get_element("cant_test").click()

    def click_switch_class(self):
        self.home_page.get_element("switch_class").click()

    def get_title_name(self):
        try:
            time.sleep(2)
            text = self.home_page.get_element("title_name").text
            print(text)
            return text
        except:
            return None
Exemplo n.º 5
0
class Product_detail_handle(object):
    def __init__(self, driver):
        self.driver = driver
        self.file_path = ".\\config\\shop_product.ini"
        self.pdh = FindElement(self.driver,
                               file_path=self.file_path,
                               node="not_logged_in_product_detail")

    def click_return_bottom(self):
        self.pdh.get_element("return_button").click()

    def get_product_detail_text(self):
        try:
            text = self.pdh.get_element("buy_product").text
            return text
        except:
            return None

    def click_return_shop_button(self):
        self.pdh.get_element("return_shop_button").click()

    def get_shop_list_title(self):
        try:
            text = self.pdh.get_element("product_list_text").text
            return text
        except:
            return None

    def click_add_favourite_product(self):
        self.pdh.get_element("add_favourite_product").click()

    def get_login_button(self):
        try:
            text = self.pdh.get_element("login_button").text
            return text
        except:
            return None

    def click_shopping_bag(self):
        self.pdh.get_element("shopping_bag").click()

    def get_shopping_bag_title(self):
        try:
            text = self.pdh.get_element("shopping_bag_title").text
            return text
        except:
            return None

    def click_share_button(self):
        time.sleep(2)
        self.pdh.get_element("share_product").click()

    def click_add_product_bag(self):
        self.pdh.get_element("add_shopping_bag").click()

    def click_buy_button(self):
        self.pdh.get_element("buy_product").click()

    def get_confirm_button_text(self):
        try:
            text = self.pdh.get_element("confirm_button").text
            return text
        except:
            return None

    def click_buy_confirm_button(self):
        self.pdh.get_element("confirm_button").click()

    def click_plus_product_button(self):
        self.pdh.get_element("plus_product").click()

    def click_mins_product_button(self):
        self.pdh.get_element("mins_produt").click()

    def get_mins_toast_error(self):
        try:
            text = self.pdh.get_element("mins_product_error").text
            return text
        except:
            return None

    def send_product_quantity(self, value):
        self.pdh.get_element("quantity_element_text").send_keys(value)

    def get_quantity_text(self):
        try:
            element = self.pdh.get_element("quantity_element_text")
            text = element.get_attribute(
                self.pdh.get_element("quantity_element"))
            return text
        except:
            return None

    def click_close_button(self):
        self.pdh.get_element("close_button").click()

    def get_choose_quantity_text(self):
        try:
            text = self.pdh.get_element("choose_quantity_button").text
            return text
        except:
            return None
Exemplo n.º 6
0
class Shoplist_handle(object):
    def __init__(self,driver):
        self.driver = driver
        self.file_path = ".\\config\\shop_product.ini"
        self.sl = FindElement(self.driver,file_path=self.file_path,node="not_logged_in_shop_list")

    def click_product_button(self):
        self.sl.get_element("product").click()
        return self.get_product_detail_text()
    
    def get_product_detail_text(self):
        try:
            text = self.sl.get_element("product_detail").text
            return text
        except:
            return None

    def switch_tabber_shopping_bag(self):
        self.sl.get_element("shopping_bag").click()
        return self.get_shopping_bag_title

    def get_shopping_bag_title(self):
        try:
            text = self.sl.get_element("shopping_bag_title").text
            return text
        except: 
            return None

    def click_search_button(self):
        self.sl.get_element("search_button").click()
        return self.get_search_text()

    def get_search_text(self):
        try:
            text = self.sl.get_element("search_text").text
            return text
        except:
            return None

    def click_share_button(self):
        time.sleep(2)
        self.sl.get_element("share_button").click()
        return self.get_login_text()

    def get_login_text(self):
        try:
            text = self.sl.get_element("login_button").text
            return text
        except: 
            return None

    def click_add_product_button(self):
        self.sl.get_element("add_shopping_bag_button").click()
        return self.get_login_text()
Exemplo n.º 7
0
class LoginSMSHandle(object):
    def __init__(self, driver):
        self.driver = driver
        self.Login = FindElement(self.driver)

    # 输入手机号
    def send_phone_number(self, phone_number):
        self.Login.get_element("phone_number").send_keys(phone_number)

    # 获取验证码
    def get_phone_code(self):
        self.Login.get_element("get_code").click()

    # 输入验证码
    def send_phone_code_element(self, code):
        self.Login.get_element("Verification_code").send_keys(code)

    # 点击登录
    def click_button(self):
        self.Login.get_element("login_button").click()

    # 获取错误信息
    def get_error_message(self):
        time.sleep(2)
        message = self.Login.get_element("error_message").text
        return message

    # 获取登录按钮文本
    def get_login_button_text(self):
        try:
            text = self.Login.get_element("login_button").text
            return text
        except:
            return None

    # 切换密码登录
    def click_switch_password(self):
        self.Login.get_element("get_password_mode").click()

    # 获取密码登录文案
    def click_switch_password_text(self):
        try:
            text = self.Login.get_element("get_password_mode").text
            return text
        except:
            return None
Exemplo n.º 8
0
class Login_password_Handle(object):
    def __init__(self, driver):
        self.driver = driver
        self.Login = FindElement(self.driver,
                                 file_path=None,
                                 node="LogPasswordElement")

    def send_phone_number(self, phone):
        self.Login.get_element("phone_number").send_keys(phone)

    def send_password_element(self, password):
        self.Login.get_element("phone_password").send_keys(password)

    def click_button(self):
        self.Login.get_element("login_button").click()

    def click_code_mode_button(self):
        self.Login.get_element("code_mode").click()

    def click_retrieve_the_password(self):
        self.Login.get_element("retrieve_the_password").click()

    # 获取验证码登陆时获取验证码按钮的文案
    def get_code_text(self):
        time.sleep(1)
        try:
            text = self.Login.get_element("get_code_text").text
            return text
        except:
            return None

    # 获取找回密码返回登陆的文案
    def get_return_password_mode_text(self):
        time.sleep(1)
        try:
            text = self.Login.get_element("return_password_mode_text").text
            return text
        except:
            return None

    # 获取错误信息
    def get_error_message(self):
        time.sleep(1)
        message = self.Login.get_element("error_message").text
        return message

    def get_login_button_text(self):
        time.sleep(1)
        try:
            text = self.Login.get_element("login_button").text
            return text
        except:
            return None
Exemplo n.º 9
0
class Login_retireve_password_Handle(object):
    def __init__(self, driver):
        self.driver = driver
        self.Login = FindElement(self.driver, file_path=None, node="Retrieve")

    def send_phone_number(self, phone):
        self.Login.get_element("phone_number").send_keys(phone)

    def send_phone_code(self, code):
        self.Login.get_element("Verification_code").send_keys(code)

    def send_password(self, password):
        self.Login.get_element("password").send_keys(password)

    def send_password_confirm(self, confirm_password):
        self.Login.get_element("confirm_password").send_keys(confirm_password)

    def click_get_verification_code(self):
        self.Login.get_element("get_code").click()

    def click_login_button(self):
        self.Login.get_element("login_button").click()

    def click_return_password_mode(self):
        self.Login.get_element("return_password_mode_button").click()

    def get_error_message(self):
        try:
            time.sleep(2)
            text = self.Login.get_element("error_message").text
            return text
        except:
            return None

    def click_button(self):
        self.Login.get_element("login_button").click()

    # 判断返回登录按钮文案是否存在
    def get_return_password_button_text(self):
        try:
            time.sleep(4)
            text = self.Login.get_element("return_password_mode_text").text
            return text
        except:
            return None
Exemplo n.º 10
0
class my_p(object):
    def __init__(self, driver):
        self.driver = driver
        self.file_path = os.path.join(os.getcwd() + "/config/" +
                                      "my_information.ini")
        self.mp = FindElement(self.driver,
                              file_path=self.file_path,
                              node="information")

    def click_set_button(self):
        self.mp.get_element("set_button").click()

    def click_talk_button(self):
        self.mp.get_element("talk").click()

    def click_login_button(self):
        self.mp.get_element("login_button").click()

    def click_all_order_button(self):
        self.mp.get_element("all_order").click()

    def click_wait_pay_button(self):
        self.mp.get_element("wait_pay_button").click()

    def click_good_to_be_received_button(self):
        self.mp.get_element("good_to_be_received").click()

    def click_to_be_delivered_button(self):
        self.mp.get_element("to_be_delivered").click()

    def click_received_button(self):
        self.mp.get_element("received").click()

    def click_my_wallet_button(self):
        self.mp.get_element("my_wallet").click()

    def click_my_favourite_button(self):
        self.mp.get_element("my_favourite").click()

    def click_my_customer_service_button(self):
        self.mp.get_element("customer_service").click()

    def get_login_button_text(self):
        try:
            text = self.mp.get_element("login_page_button").text
            return text
        except:
            return None