Ejemplo n.º 1
0
class AddCart_Page(BasePage):
    #加入购物车页面测试
    def __init__(self, driver):
        self.addcart = BasePage(driver, node='AddCartElement')

    def addcart_case(self):
        #先调用登录case后再运行
        self.addcart.find_element('book').click()
        self.addcart.find_element('literature').click()
        self.addcart.find_element('addcart').click()
Ejemplo n.º 2
0
class Login_Page(BasePage):
    def __init__(self, driver):
        self.login = BasePage(driver, node='LoginElement')

    def login_case(self, email, password):
        self.login.find_element('email').send_keys(email)
        self.login.find_element('password').send_keys(password)
        self.login.find_element('loginbutton').click()

    def login_err(self, email, password):
        self.login_case(email, password)
        text = self.login.find_element('loginerr').text
        if text is not None:
            return True
        else:
            return False
Ejemplo n.º 3
0
class Register_Page(BasePage):
    def __init__(self, driver):
        self.rg = BasePage(driver, node='RegisterElement')
        #self.ri = ReadINI(node='ErrInfo')
    def register_case(self, firstname, lastname, email, telephone, password):
        self.rg.find_element('lastname').send_keys(lastname)
        self.rg.find_element('firstname').send_keys(firstname)
        self.rg.find_element('email').send_keys(email)
        self.rg.find_element('telephone').send_keys(telephone)
        self.rg.find_element('password').send_keys(password)
        self.rg.find_element('confirmPassword').send_keys(password)
        self.rg.find_element('checkbox').click()
        self.rg.find_element('sliderButton').click()
        err_text = []
        #如果对应输入框存在错误提示信息,则拼接到err_text中返回
        if self.rg.find_element('firstname_err') is not None:
            err_text.append(
                ['firstname_err',
                 self.rg.find_element('firstname_err').text])
        if self.rg.find_element('lastname_err') is not None:
            err_text.append(
                ['lastname_err',
                 self.rg.find_element('lastname_err').text])
        if self.rg.find_element('email_err') is not None:
            err_text.append(
                ['email_err',
                 self.rg.find_element('email_err').text])
        if self.rg.find_element('phone_err') is not None:
            err_text.append(
                ['phone_err',
                 self.rg.find_element('phone_err').text])
        if self.rg.find_element('password_err') is not None:
            err_text.append(
                ['password_err',
                 self.rg.find_element('password_err').text])
        return err_text

    def register_phone_err(self, firstname, lastname, email, telephone,
                           password):
        self.register_case(firstname, lastname, email, telephone, password)
Ejemplo n.º 4
0
class Buy_Page(BasePage):
    def __init__(self, driver):
        self.buy = BasePage(driver, node='BuyElement')

    def buy_case(self):
        #先调用登录case后再运行
        self.buy.find_element('cart').click()
        self.buy.find_element('gobuy').click()
        time.sleep(1)
        self.buy.find_element('payaddresscontinue').click()
        time.sleep(1)
        self.buy.find_element('shopaddresscontinue').click()
        time.sleep(1)
        self.buy.find_element('methodcontinue').click()
        time.sleep(1)
        self.buy.find_element('agree').click()
        time.sleep(1)
        self.buy.find_element('paymethod').click()
        time.sleep(1)
        self.buy.find_element('confirm').click()
Ejemplo n.º 5
0
class Address_Page(BasePage):
    #地址管理页面测试
    def __init__(self,driver):
        self.address = BasePage(driver,node='AddressElement')

    def address_add_case(self,firstname,lastname,address,city,country,zone):

        #调用登录后,选择右侧地址管理按钮进入地址管理页面
        self.address.find_element('addressmanage').click()
        time.sleep(2)
        self.address.find_element('newaddress').click()
        time.sleep(2)
        self.address.find_element('firstname').send_keys(firstname)
        self.address.find_element('lastname').send_keys(lastname)
        self.address.find_element('address').send_keys(address)
        self.address.find_element('city').send_keys(city)
        countryElement = self.address.find_element('country')
        selCountry = Select(countryElement)
        selCountry.select_by_visible_text(country)
        zoneElement = self.address.find_element('zone')
        selZone = Select(zoneElement)
        selZone.select_by_visible_text(zone)
        self.address.find_element('addbutton').click()
Ejemplo n.º 6
0
 def find_element(self, element, node):
     el = BasePage(self.driver, node)
     return el.find_element(element)