def test_case_001_forget_password(self):
     Conf.CASE_NAME = "test_case_001_forget_password"
     
     Log.start_test(Conf.CASE_NAME)
     
     Element.find_element(self.driver, By.CLASS_NAME, u'pass-fgtpwd').click()
     Log.stop_test()
示例#2
0
 def test_case_search_001(self):
     Conf.CASE_NAME = "test_case_search_001"
     Log.start_test(Conf.CASE_NAME)
     
     CommonMethod.test_pofs_login_common('EDPRBI', 'test')
     
     Log.stop_test()
示例#3
0
    def test_case_login_002(self):
        '''Login page, reset button'''
        Conf.CASE_NAME = "test_case_login_002"
         
        Log.start_test(Conf.CASE_NAME)
        
        self.POFS_USERNAME = Element.find_element(By.NAME, u'userName')
        self.POFS_PASSWORD = Element.find_element(By.NAME, u'password')
        self.POFS_RESET = Element.find_element(By.XPATH, u'//input[@type="reset"][@value="Reset"]')
         
        self.POFS_USERNAME.send_keys("EDPRBI")
        self.POFS_PASSWORD.send_keys("test")
        self.POFS_RESET.click()
        
        username = self.driver.execute_script("var input = document.getElementsByName('userName')[0].value;return input")
        password = self.driver.execute_script("var input = document.getElementById('password').value;return input")
        Assert().assert_equal(username, "")
        Assert().assert_equal(password, "")
        if username == "" and password == "":
            print "pass"
        else:
            print "fail"

#         self.driver.get(Conf.URL)
        Browser.navigate_to(Conf.URL)
        
        Log.stop_test()
示例#4
0
 def test_case_search_002(self):
     Conf.CASE_NAME = "test_case_search_002"
     Log.start_test(Conf.CASE_NAME)
     
     POFS_OVERVIEW_SEARCH = Element.find_element(By.XPATH, u'//a[@id="b"][@href="overview/overview.jsp"]')
     POFS_OVERVIEW_SEARCH.click()
     
     POFS_EXPTYPE = Element.find_elements(By.XPATH, u'//select[@name="exportType"]/option')
     POFS_EXPTYPE_CONTENT = Element.get_spinner_values(By.XPATH, u'//select[@name="exportType"]/option')
     Element.choose_spinner_value(POFS_EXPTYPE, POFS_EXPTYPE_CONTENT, "LCL")
     
     POFS_PO_ISSUE_DATE = Element.find_element(By.XPATH, u'//img[@src="../images/cal.gif"]')
     POFS_PO_ISSUE_DATE.click()
     
     Browser.switch_to_new_window()
     Element.date_picker(31, 1, 2008)
     Browser.switch_to_default_window()
     
     POFS_SEARCH = Element.find_element(By.NAME, u'submit')
     POFS_SEARCH.click()
     
     POFS_DETAIL = Element.find_element(By.XPATH, u'//img[@src="../images/detail.gif"]')
     POFS_DETAIL.click()
     Browser.switch_to_new_window()
     POFS_PONUMBER = Element.find_element(By.XPATH, u'//*[@id="printable"]/table/tbody/tr[1]/td/table/tbody/tr[2]/td[2]')
     Assert().assert_equal(POFS_PONUMBER.text, "0000434")
     Browser.close_window()
     Browser.switch_to_default_window()
     
     Log.stop_test()
示例#5
0
    def test_case_login_003(self):
        u"""This is comment of test_case_login_003 shown in report"""
        
        Conf.CASE_NAME = "test_case_login_003"
        
        Log.start_test(Conf.CASE_NAME)

        excel = Datadriver.ExcelSheet(r"Employee.xlsx", "Sheet1")
        
        for i in range(1, excel.nrows()):
            employeeID = excel.cell(i, "Empoyee_ID")
            password = excel.cell(i, "Password")
            expect = excel.cell(i, "Expect")
            
            if employeeID !="":
                Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__userName').send_keys(employeeID)
            if password != "":
                Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__password').send_keys(password)
            Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__submit').click()
            print Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__error').text
            if expect == "expect_result_1":
                # Maybe the element should be asserted is the same one.
                # Change it in every iteration.
                Assert().assert_equal(Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__error').text, expect)
            elif expect == "expect_result_2":
                Assert().assert_equal(Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__error').text, expect)
            elif expect == "expect_result_3":
                Assert().assert_equal(Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__error').text, expect)
            else:
                return None
#             self.driver.get(Conf.URL)
            Browser.navigate_to(self.driver, Conf.URL)
        
        Log.stop_test()
示例#6
0
    def test_case_search_001(self):
        Conf.CASE_NAME = "test_case_search_001"
        Log.start_test(Conf.CASE_NAME)

        CommonMethod.test_pofs_login_common('EDPRBI', 'test')

        Log.stop_test()
示例#7
0
    def test_case_login_002(self):
        '''Login page, reset button'''
        Conf.CASE_NAME = "test_case_login_002"

        Log.start_test(Conf.CASE_NAME)

        self.POFS_USERNAME = Element.find_element(By.NAME, u'userName')
        self.POFS_PASSWORD = Element.find_element(By.NAME, u'password')
        self.POFS_RESET = Element.find_element(
            By.XPATH, u'//input[@type="reset"][@value="Reset"]')

        self.POFS_USERNAME.send_keys("EDPRBI")
        self.POFS_PASSWORD.send_keys("test")
        self.POFS_RESET.click()

        username = self.driver.execute_script(
            "var input = document.getElementsByName('userName')[0].value;return input"
        )
        password = self.driver.execute_script(
            "var input = document.getElementById('password').value;return input"
        )
        Assert().assert_equal(username, "")
        Assert().assert_equal(password, "")
        if username == "" and password == "":
            print "pass"
        else:
            print "fail"


#         self.driver.get(Conf.URL)
        Browser.navigate_to(Conf.URL)

        Log.stop_test()
示例#8
0
 def test_case_001_register(self):
     Conf.CASE_NAME = "test_case_001_register"
     
     Log.start_test(Conf.CASE_NAME)
           
     PAN_C = Element.find_element(self.driver, By.ID, u'login-create')
     print PAN_C.text
     Log.stop_test()
示例#9
0
    def test_case_001_forget_password(self):
        Conf.CASE_NAME = "test_case_001_forget_password"

        Log.start_test(Conf.CASE_NAME)

        Element.find_element(self.driver, By.CLASS_NAME,
                             u'pass-fgtpwd').click()
        Log.stop_test()
示例#10
0
    def test_case_001_register(self):
        Conf.CASE_NAME = "test_case_001_register"

        Log.start_test(Conf.CASE_NAME)

        PAN_C = Element.find_element(self.driver, By.ID, u'login-create')
        print PAN_C.text
        Log.stop_test()
示例#11
0
 def test_case_login_001(self):
     '''Login page, write username and password'''
     Conf.CASE_NAME = "test_case_login_001"
      
     Log.start_test(Conf.CASE_NAME)
     
     CommonMethod.test_pofs_login_common("EDPRBI", "test")
     
     Browser.navigate_to(Conf.URL)
     Log.stop_test()
示例#12
0
    def test_case_login_001(self):
        '''Login page, write username and password'''
        Conf.CASE_NAME = "test_case_login_001"

        Log.start_test(Conf.CASE_NAME)

        CommonMethod.test_pofs_login_common("EDPRBI", "test")

        Browser.navigate_to(Conf.URL)
        Log.stop_test()
示例#13
0
 def test_case_login_002(self):
     u"""This is comment of test_case_login_002 shown in report"""
     Conf.CASE_NAME = "test_case_login_002"
     
     Log.start_test(Conf.CASE_NAME)
     
     Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__userName').send_keys("jiefenggaoa")
     Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__password').send_keys("P@ssw0rd")
     Element.find_element(self.driver, By.ID, u'TANGRAM__PSP_4__submit').click()
     
     Browser.navigate_to(self.driver, Conf.URL)
     Log.stop_test()
示例#14
0
 def test_case_login_001(self):
     Conf.CASE_NAME = "testCase001_Login"
     
     # Start to execute case and record the starting time
     Log.start_test(Conf.CASE_NAME)
     
     Csdn = import_module_dynamic("Csdn")
     Csdn.Profile.CSDN_USERNAME.send_keys("jiefenggao")
     Csdn.Profile.CSDN_PASSWORD.send_keys("gaojiefeng")
     Csdn.Profile.CSDN_SUBMIT.click()
     
     Log.stop_test()
示例#15
0
    def test_case_login_001(self):
        Conf.CASE_NAME = "testCase001_Login"

        # Start to execute case and record the starting time
        Log.start_test(Conf.CASE_NAME)

        Csdn = import_module_dynamic("Csdn")
        Csdn.Profile.CSDN_USERNAME.send_keys("jiefenggao")
        Csdn.Profile.CSDN_PASSWORD.send_keys("gaojiefeng")
        Csdn.Profile.CSDN_SUBMIT.click()

        Log.stop_test()
示例#16
0
 def test_tour_login_001(self):
     u"""This is comment of test_case_login_001 shown in report"""
     Conf.CASE_NAME = "test_tour_login_001"
      
     Log.start_test(Conf.CASE_NAME)
     
     Element.find_element(By.NAME, u'userName').send_keys("a")
     Element.find_element(By.NAME, u'password').send_keys("a")
     Element.find_element(By.NAME, u'login').click()
     
     Browser.navigate_to(Conf.URL)
     Log.stop_test()
示例#17
0
    def test_case_login_003(self):
        u"""This is comment of test_case_login_003 shown in report"""

        Conf.CASE_NAME = "test_case_login_003"

        Log.start_test(Conf.CASE_NAME)

        excel = Datadriver.ExcelSheet(r"Employee.xlsx", "Sheet1")

        for i in range(1, excel.nrows()):
            employeeID = excel.cell(i, "Empoyee_ID")
            password = excel.cell(i, "Password")
            expect = excel.cell(i, "Expect")

            if employeeID != "":
                Element.find_element(
                    self.driver, By.ID,
                    u'TANGRAM__PSP_4__userName').send_keys(employeeID)
            if password != "":
                Element.find_element(
                    self.driver, By.ID,
                    u'TANGRAM__PSP_4__password').send_keys(password)
            Element.find_element(self.driver, By.ID,
                                 u'TANGRAM__PSP_4__submit').click()
            print Element.find_element(self.driver, By.ID,
                                       u'TANGRAM__PSP_4__error').text
            if expect == "expect_result_1":
                # Maybe the element should be asserted is the same one.
                # Change it in every iteration.
                Assert().assert_equal(
                    Element.find_element(self.driver, By.ID,
                                         u'TANGRAM__PSP_4__error').text,
                    expect)
            elif expect == "expect_result_2":
                Assert().assert_equal(
                    Element.find_element(self.driver, By.ID,
                                         u'TANGRAM__PSP_4__error').text,
                    expect)
            elif expect == "expect_result_3":
                Assert().assert_equal(
                    Element.find_element(self.driver, By.ID,
                                         u'TANGRAM__PSP_4__error').text,
                    expect)
            else:
                return None


#             self.driver.get(Conf.URL)
            Browser.navigate_to(self.driver, Conf.URL)

        Log.stop_test()
示例#18
0
    def test_case_login_003(self):
        '''Login page, wrong username and correct password'''
        
        Conf.CASE_NAME = "test_case_login_003"
        Log.start_test(Conf.CASE_NAME)
        
        CommonMethod.test_pofs_login_common("EDPRBIa", "test")
        error_message = Element.find_element(By.XPATH, u'//td[@class="subhead"][@align="center"]').text
        Assert().assert_equal(error_message, "Invalid UserID or Password. Attempt 1 of 6.")
        
#         self.driver.get(Conf.URL)
        Browser.navigate_to(Conf.URL)
        
        Log.stop_test()
示例#19
0
    def testCase001_Login(self):
        '''This always is the 1st case for automation'''
        Conf.CASE_NAME = "testCase001_Login"

        # Start to execute case and record the starting time
        Log.start_test(Conf.CASE_NAME)

        # Which page you want to import, use name of this page as a parameter.
        Login = import_module_dynamic("Login")
        Login.Profile.POFS_USERNAME.send_keys(Conf.USERNAME)
        Login.Profile.POFS_PASSWORD.send_keys(Conf.PASSWORD)
        Login.Profile.POFS_SUBMIT.click()
        time.sleep(1)

        Log.stop_test()
示例#20
0
 def testCase001_Login(self):
     '''This always is the 1st case for automation'''
     Conf.CASE_NAME = "testCase001_Login"
     
     # Start to execute case and record the starting time
     Log.start_test(Conf.CASE_NAME)
     
     # Which page you want to import, use name of this page as a parameter.
     Login = import_module_dynamic("Login")
     Login.Profile.POFS_USERNAME.send_keys(Conf.USERNAME)
     Login.Profile.POFS_PASSWORD.send_keys(Conf.PASSWORD)
     Login.Profile.POFS_SUBMIT.click()
     time.sleep(1)
     
     Log.stop_test()
示例#21
0
    def test_case_login_002(self):
        u"""This is comment of test_case_login_002 shown in report"""
        Conf.CASE_NAME = "test_case_login_002"

        Log.start_test(Conf.CASE_NAME)

        Element.find_element(
            self.driver, By.ID,
            u'TANGRAM__PSP_4__userName').send_keys("jiefenggaoa")
        Element.find_element(self.driver, By.ID,
                             u'TANGRAM__PSP_4__password').send_keys("P@ssw0rd")
        Element.find_element(self.driver, By.ID,
                             u'TANGRAM__PSP_4__submit').click()

        Browser.navigate_to(self.driver, Conf.URL)
        Log.stop_test()
示例#22
0
    def test_case_login_003(self):
        '''Login page, wrong username and correct password'''

        Conf.CASE_NAME = "test_case_login_003"
        Log.start_test(Conf.CASE_NAME)

        CommonMethod.test_pofs_login_common("EDPRBIa", "test")
        error_message = Element.find_element(
            By.XPATH, u'//td[@class="subhead"][@align="center"]').text
        Assert().assert_equal(error_message,
                              "Invalid UserID or Password. Attempt 1 of 6.")

        #         self.driver.get(Conf.URL)
        Browser.navigate_to(Conf.URL)

        Log.stop_test()
示例#23
0
    def testCase002_Search(self):
        '''testCase002_Search is dependent on testCase001_Login'''
        Conf.CASE_NAME = "testCase002_Search"

        Home = import_module_dynamic("Home")
        Assert().assert_equal(Home.Profile.POFS_TITLE.text,
                              "P.O. Tracking Application0")
        Assert().assert_equal(Home.Profile.POFS_HEADER.text,
                              "Application Main Menu")
        Assert().assert_equal(Home.Profile.POFS_LOGOUT.text, "Log Out")
        Home.Profile.POFS_OVERVIEW_SEARCH.click()

        OverviewSearch = import_module_dynamic("OverviewSearch")
        #         OverviewSearch.Profile.POFS_PONO.send_keys("0000434")
        #         OverviewSearch.Profile.POFS_EXPTYPE[1].click()

        Assert().assert_equal_spinder(
            OverviewSearch.Profile.POFS_EXPTYPE_CONTENT,
            ["LCLa", "FCL", "Select", "AIR", "TRUCK"])
        choose_spinner_value(OverviewSearch.Profile.POFS_EXPTYPE,
                             OverviewSearch.Profile.POFS_EXPTYPE_CONTENT,
                             "LCL")

        OverviewSearch.Profile.POFS_PO_ISSUE_DATE.click()

        switch_to_new_window()
        import_module_dynamic("OverviewSearchDatePicker")
        switch_to_default_window()

        OverviewSearch.Profile.POFS_SEARCH.click()

        OverviewSearchResult = import_module_dynamic("OverviewSearchResult")
        OverviewSearchResult.Profile.POFS_DETAIL.click()
        time.sleep(2)
        switch_to_new_window()
        OverviewSearchResultDetail = import_module_dynamic(
            "OverviewSearchResultDetail")
        Assert().assert_equal(
            OverviewSearchResultDetail.Profile.POFS_PONUMBER.text, "0000434")
        close_window()
        switch_to_default_window()

        time.sleep(2)

        #Stop and  case and record the starting time
        Log.stop_test()
示例#24
0
 def test_case_logout_001(self):
     '''Login page, write username and password'''
     Conf.CASE_NAME = "test_case_logout_001"
      
     Log.start_test(Conf.CASE_NAME)
     
     #Login
     CommonMethod.test_pofs_login_common()
     
     #Logout
     self.POFS_LOGOUT = Element.find_element(By.XPATH, u'//a[@href="login/logout.jsp"]')
     Assert().assert_equal(self.POFS_LOGOUT.text, "Log Out")
     self.POFS_LOGOUT.click()
     
     self.POFS_LOGOUT_MESSAGE = Element.find_element(By.XPATH, u'//td[@align="right"][@style=" color: red;"]').text
     print self.POFS_LOGOUT_MESSAGE
     Assert().assert_equal(self.POFS_LOGOUT_MESSAGE, "You are successfully logged out")
     
     Log.stop_test()
示例#25
0
    def test_case_search_002(self):
        Conf.CASE_NAME = "test_case_search_002"
        Log.start_test(Conf.CASE_NAME)

        POFS_OVERVIEW_SEARCH = Element.find_element(
            By.XPATH, u'//a[@id="b"][@href="overview/overview.jsp"]')
        POFS_OVERVIEW_SEARCH.click()

        POFS_EXPTYPE = Element.find_elements(
            By.XPATH, u'//select[@name="exportType"]/option')
        POFS_EXPTYPE_CONTENT = Element.get_spinner_values(
            By.XPATH, u'//select[@name="exportType"]/option')
        Element.choose_spinner_value(POFS_EXPTYPE, POFS_EXPTYPE_CONTENT, "LCL")

        POFS_PO_ISSUE_DATE = Element.find_element(
            By.XPATH, u'//img[@src="../images/cal.gif"]')
        POFS_PO_ISSUE_DATE.click()

        Browser.switch_to_new_window()
        Element.date_picker(31, 1, 2008)
        Browser.switch_to_default_window()

        POFS_SEARCH = Element.find_element(By.NAME, u'submit')
        POFS_SEARCH.click()

        POFS_DETAIL = Element.find_element(
            By.XPATH, u'//img[@src="../images/detail.gif"]')
        POFS_DETAIL.click()
        Browser.switch_to_new_window()
        POFS_PONUMBER = Element.find_element(
            By.XPATH,
            u'//*[@id="printable"]/table/tbody/tr[1]/td/table/tbody/tr[2]/td[2]'
        )
        Assert().assert_equal(POFS_PONUMBER.text, "0000434")
        Browser.close_window()
        Browser.switch_to_default_window()

        Log.stop_test()
示例#26
0
    def test_tour_register_001(self):
        u"""This is comment of test_case_login_001 shown in report"""
        Conf.CASE_NAME = "test_tour_register_001"
        register_text = "000To create your account, we'll need some basic information about you. This information will be used to send reservation confirmation emails, mail tickets when needed and contact you if your travel arrangements change. Please fill in the form completely."
         
        Log.start_test(Conf.CASE_NAME)
        
        Element.find_element(By.LINK_TEXT, u'REGISTER').click()
        time.sleep(2)
        register_desc = Element.find_element(By.XPATH, u'html/body/div[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/p/font').text
        if "To create your account" in register_desc:
            Log.step_succ("Navigate to register page successfully.")
            Assert().assert_equal(register_text, register_desc)
            
            excel = Datadriver.ExcelSheet(r"Employee.xlsx", "Sheet2")
            
            for i in range(1, excel.nrows()):
                first_name       = excel.cell(i, "first")
                last_name        = excel.cell(i, "last")
                phone            = excel.cell(i, "phone")
                email            = excel.cell(i, "email")
                address1         = excel.cell(i, "address1")
                address2         = excel.cell(i, "address2")
                city             = excel.cell(i, "city")
                state            = excel.cell(i, "state")
                postal           = excel.cell(i, "postal")
                country          = excel.cell(i, "country")
                username         = excel.cell(i, "username")
                password         = excel.cell(i, "password")
                confirm_password = excel.cell(i, "confirm_password")
                
                if first_name !="":
                    Element.find_element(By.NAME, u'firstName').send_keys(first_name)
                if last_name != "":
                    Element.find_element(By.NAME, u'lastName').send_keys(last_name)
                if phone !="":
                    Element.find_element(By.NAME, u'phone').send_keys(phone)
                if email !="":
                    Element.find_element(By.NAME, u'userName').send_keys(email)
                if address1 !="":
                    Element.find_element(By.NAME, u'address1').send_keys(address1)
                if address2 !="":
                    Element.find_element(By.NAME, u'address2').send_keys(address2)
                if city !="":
                    Element.find_element(By.NAME, u'city').send_keys(city)
                if state !="":
                    Element.find_element(By.NAME, u'state').send_keys(state)
                if postal !="":
                    Element.find_element(By.NAME, u'postalCode').send_keys(postal)
                if country != "":
                    Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="country"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="country"]/option'),
                                                  "ANGOLA")
                if username != "":
                    Element.find_element(By.NAME, u'email').send_keys(username)
                if password != "":
                    Element.find_element(By.NAME, u'password').send_keys(password)
                if confirm_password != "":
                    Element.find_element(By.NAME, u'confirmPassword').send_keys(confirm_password)
                Element.find_element(By.NAME, u'register').click()
        else:
            Log.step_fail("Navigate to register page failed.")
        
        register_succ_desc = Element.find_element(By.XPATH, u'html/body/div[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/p[1]/font/b').text
        if "Dear" in register_succ_desc:
            Log.step_succ("Register for user %s successfully." % username)
        else:
            Log.step_fail("Register for user %s failed." % username)
        
#         Browser.navigate_to( Conf.URL)
        Log.stop_test()
    def test_tour_order_flight_001(self):
        u"""This is comment of test_case_login_001 shown in report"""
        Conf.CASE_NAME = "test_tour_order_flight_001"
         
        Log.start_test(Conf.CASE_NAME)
        
#         Element.find_element(By.NAME, u'userName').send_keys("a")
#         Element.find_element(By.NAME, u'password').send_keys("a")
#         Element.find_element(By.NAME, u'login').click()
        
        CommonMethod.test_tour_login_common()
        
        
        
        login_flag = Element.find_element(By.XPATH, u'//img[@src="/images/masts/mast_flightfinder.gif"]')
        if login_flag is not None:
            print "Login system successfully."
            Log.step_succ("Login system successfully.")
        else:
            print "Login system failed."
            Log.step_fail("Login system failed.")
            return None
        #### Flight Details
        Element.find_element(By.XPATH, u'//input[@value="oneway"]').click()
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="passCount"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="passCount"]/option'),
                                                  "4")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="fromPort"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromPort"]/option'),
                                                  "Paris")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="fromMonth"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromMonth"]/option'),
                                                  "September")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="fromDay"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromDay"]/option'),
                                                  "9")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="toPort"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="toPort"]/option'),
                                                  "London")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="toMonth"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromMonth"]/option'),
                                                  "October")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="toDay"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromDay"]/option'),
                                                  "19")
        
        #### Preferences
        Element.find_element(By.XPATH, u'//input[@value="Business"]').click()
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="airline"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="airline"]/option'),
                                                  "Unified Airlines")
        Element.find_element(By.NAME, "findFlights").click()
        
        #### DEPART
        if "DEPART" in Element.find_element(By.XPATH, u'//font[@color="#FF9900"][text()="DEPART"]').text:
            print "Navigate success, please choosing departure item."
            Log.step_succ("Navigate success, please choosing departure item.")
        else:
            print "Navigate failed, please check info in FLIGHT FINDER."
            Log.step_fail("Navigate failed, please check info in FLIGHT FINDER.")
            return None
        
        Element.find_element(By.XPATH, u'//input[@value="Pangea Airlines$362$274$9:17"][@name="outFlight"]').click()
        #### RETURN
        Element.find_element(By.XPATH, u'//input[@value="Blue Skies Airlines$631$273$14:30"][@name="inFlight"]').click()
        Element.find_element(By.NAME, u'reserveFlights').click()
        
        #### BOOK A FLIGHT
        book_flight = Element.find_element(By.XPATH, u'//img[@src="/images/masts/mast_book.gif"]')
        if book_flight is not None:
            print "Navigate success, please complete the form to book the flight online."
            Log.step_succ("Navigate success, please complete the form to book the flight online.")
        else:
            print "Navigate failed, please check DEPART/RETURN info in SELECT FLIGHT."
            Log.step_fail("Navigate failed, please check DEPART/RETURN info in SELECT FLIGHT.")
            return None
        
        Element.find_element(By.NAME, u'passFirst0').send_keys("Jiefeng")
        Element.find_element(By.NAME, u'passLast0').send_keys("Gao")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="pass.0.meal"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="pass.0.meal"]/option'),
                                                  "Diabetic")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="creditCard"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="creditCard"]/option'),
                                                  "Discover")
        Element.find_element(By.NAME, u'creditnumber').send_keys("0000000000000000000")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="cc_exp_dt_mn"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="cc_exp_dt_mn"]/option'),
                                                  "06")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="cc_exp_dt_yr"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="cc_exp_dt_yr"]/option'),
                                                  "2008")
        Element.find_element(By.NAME, u'cc_frst_name').send_keys("Gao")
        Element.find_element(By.NAME, u'cc_mid_name').send_keys("Jie")
        Element.find_element(By.NAME, u'cc_last_name').send_keys("feng")
        Element.find_element(By.NAME, u'ticketLess').click()
        
        Element.checkbox_all(Element.find_elements(By.NAME, u'ticketLess'))
        
        Element.find_element(By.NAME, u'buyFlights').click()
        
        #### FLIGHT CONFIRMATION
        confirmation_message = Element.find_element(By.XPATH, u'//img[@src="/images/masts/mast_confirmation.gif"]')
        if confirmation_message is not None:
            print "Book a flight successfully."
            Log.step_succ("Book a flight successfully.")
        else:
            print "Book a flight failed."
            Log.step_fail("Book a flight failed.")
        
        Element.find_element(By.XPATH, u'//img[@ src="/images/forms/home.gif"]').click()
        
        """Here's something should do calculate :
                Total Taxes:      $44 USD
                Total Price (including taxes):      $584 USD
        """
        
        Browser.navigate_to(Conf.URL)
        Log.stop_test()