Exemplo n.º 1
0
class LoginPage():
    def __init__(self, driver):

        self.driver = driver
        self.base = Base(self.driver)

    def login_name(self, username):

        self.base.clear_element("name=>email")
        self.base.sendkeys("name=>email", username)

    def login_pasw(self, password):

        self.base.clear_element('name=>password')
        self.base.sendkeys('name=>password', password)

    def login_button(self):

        self.base.click_element('id=>dologin')

    def switch_frame(self):

        self.base.switch_frame('id=>x-URS-iframe')

    def switch_frame_out(self):
        self.base.switch_frame_out()
Exemplo n.º 2
0
class BaiduSet(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.base = Base(self.driver)
        self.base.open("http://www.baidu.com")
        self.base.max_window()

    def test_setting(self):
        self.base.move_to_element("link_text=>设置")
        self.base.click_element("link_text=>搜索设置")
        self.base.select_element('id=>nr', '50')
        self.base.click_element('class=>prefpanelgo')

    def tearDown(self):
        self.driver.quit()