コード例 #1
0
    def login_action(self, username, password):
        self.login_page.input_username(username)
        self.login_page.input_password(password)
        self.login_page.click_login()

    def login_success(self, username, password):
        self.login_action(username, password)
        return MainPage(self.login_page.driver)

    def default_login(self):
        self.login_success(username=config.user_name,
                           password=config.pass_word)

    def login_fail(self, username, password):
        self.login_action(username, password)
        value = self.login_page.get_login_fail_alert(type='yes',
                                                     selector='alert')
        return value

    def login_by_cookie(self):
        pass


if __name__ == '__main__':
    driver1 = Browser().get_driver()
    loginaction = LoginAction(driver1)
    driver1.get(
        'http://106.53.50.202:8999/zentao2/www/user-login-L3plbnRhbzYvd3d3Lw==.html'
    )
    loginaction.login_success('chenjuan', '1q2w3e4r,')
コード例 #2
0
from elements_infos.login.login_page import LoginPage
from elements_infos.main.main_page import MainPage
from common.config_utils import local_config
from common.browser import Browser


class QuitAction:
    def __init__(self, driver):
        self.main_page = MainPage(driver)

    def quit(self):
        self.main_page.click_username()
        self.main_page.click_quit_button()
        return LoginPage(self.main_page.driver)


if __name__ == '__main__':
    driver = Browser().get_driver()
    driver.get('http://47.107.178.45/zentao/www/index.php?m=user&f=login')
コード例 #3
0
import os,time
from selenium import webdriver
from selenium.webdriver.common.by import By
from actions.login_action import loginAction
from common.log_utlis import logger
from common.base_page import BasePage
from common.element_data_utils import ElementdataUtils
from common.browser import Browser

driver = Browser().get_driver()
driver.get('http://127.0.0.1:81/index.php')
main_page = loginAction(driver).default_login()
value=main_page.get_username()
print(value)