コード例 #1
0
ファイル: TestCase.py プロジェクト: zhaolisi/yongche
 def test_loginERP(self):
     user = LoginPage(self.driver)
     user.username_input('zhaolisi')
     user.password_input('Zls@8891')
     user.submit_btn()
     loginuser = YiDaoHome(self.driver)
     BasePage.sleep(1)
     loginuser.enter_firstpage()
     BasePage.sleep(1)
     loginuser.enter_ERP()
     BasePage.sleep(1)
     currentwinhandler = self.driver.current_window_handle
     handles = self.driver.window_handles
     for handle in handles:
         if handle != currentwinhandler:
             self.driver.switch_to.window(handle)
     currenturl = user.get_currentpageurl()
     try:
         assert currenturl == 'https://testing.be.yongche.org/'
         print('Test Pass')
     except Exception as e:
         print('Test Fail', format(e))
コード例 #2
0
driver.clear("xpath=/html/body/div[3]/div/div[1]/div[2]/form/div[1]/input")

driver.right_click("xpath=/html/body/div[3]/div/div[1]/div[2]/form/div[1]/input")

driver.move_to_element("xpath=/html/body/div[1]/div/ul/li[1]/a")

driver.back()

driver.forward()

driver.get_attribute("xpath=/html/body/div[3]/div/div[1]/div[2]/form/div[5]/button","type")

driver.get_text("xpath=/html/body/div[3]/div/div[1]/div[2]/form/div[5]/button")

driver.get_display("xpath=/html/body/div[3]/div/div[1]/div[2]/form/div[5]/button")
driver.sleep(2)
driver.get_title()
driver.sleep(2)
driver.get_url()
driver.sleep(2)
driver.open_new_tag("http://www.baidu.com")
driver.send_keys("id=kw","hhhh")
driver.sleep(2)
driver.f5()
driver.sleep(2)
driver.js("window.open('http://www.163.com')")
driver.sleep(2)
# driver.open_new_window("xpath=/html/body/div[2]/div/ul/li[2]/a")
driver.switch_tag(0)
driver.sleep(2)
driver.switch_tag(1)
コード例 #3
0
ファイル: TestCase.py プロジェクト: zhaolisi/yongche
 def test_loginyidaohome(self):
     user = LoginPage(self.driver)
     exituser = YiDaoHome(self.driver)
     testdatapath = os.path.dirname(
         os.path.abspath('.')) + '/testdata/users.json'
     with open(testdatapath, 'r') as file:
         f = file.read().decode('utf-8-sig')
         temp = json.loads(f)
     for tester in temp.values():
         user.username_input(tester['username'])
         BasePage.sleep(1)
         user.password_input(tester['password'])
         BasePage.sleep(1)
         user.submit_btn()
         currenturl = user.get_page_url()
         print currenturl
         if currenturl == 'https://sso.yongche.org/my/securecenter':
             exituser.exit()
             BasePage.sleep(1)
             user.clear(user.usernameinputbox)
             BasePage.sleep(1)
             user.clear(user.passwordinputbox)
             BasePage.sleep(1)
         else:
             user.clear(user.usernameinputbox)
             BasePage.sleep(1)
             user.clear(user.passwordinputbox)
             BasePage.sleep(1)
         try:
             assert currenturl == 'https://sso.yongche.org/my/securecenter'
             print('Test Pass')
         except Exception as e:
             print('Test Fail', format(e))