Beispiel #1
0
 def setUp(self):
     self.driver = webdriver.Firefox()
     self.bg = BasePage(self.driver)
     try:
         self.lp = LoginPage(self.driver, "https://yun.baidu.com")
     except Exception as e:
         self.bg.save_screen("打开网页超时_")
         raise e
Beispiel #2
0
 def loging(self,username,password):
     self.bg_t=BasePage(self.driver)
     self.bg_t.get_element(self.get_in_login).click()
     self.bg_t.get_element(self.username_xpath).send_keys(username)
     self.bg_t.get_element(self.password_xpath).send_keys(password)
     """点击登录"""
     self.bg_t.get_element(self.login_click).click()
 
     
     
Beispiel #3
0
class Test_Think_sns(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.bg = BasePage(self.driver)
        try:
            self.lp = LoginPage(self.driver, "https://yun.baidu.com")
        except Exception as e:
            print("超时,截取当前图片")
            self.bg.save_screen("打开网页超时_")
            raise e

    def test_login(self):
        self.lp.loging("13550848524", "13550848524")
Beispiel #4
0
class LoginPage:
    get_in_login = "******"
    username_xpath = "//*[@id='TANGRAM__PSP_4__userName']"
    password_xpath = "//*[@id='TANGRAM__PSP_4__password']"
    login_click = "//*[@id='TANGRAM__PSP_4__submit']"

    def __init__(self, driver, url):
        self.driver = driver
        self.driver.get(url)
        self.bg_t = BasePage(self.driver)

    def loging(self, username, password):
        self.bg_t.get_element(self.get_in_login).click()
        self.bg_t.get_element(self.username_xpath).send_keys(username)
        self.bg_t.get_element(self.password_xpath).send_keys(password)
        """点击登录"""
        self.bg_t.get_element(self.login_click).click()
Beispiel #5
0
 def __init__(self, driver, url):
     self.driver = driver
     self.driver.get(url)
     self.bg_t = BasePage(self.driver)