def test_welcom_page(): result = "No.\tTest Steps\t\tResult\n-------------------------------------------\n" soket_login = webSocketThread(81) svr=ServerProxy("http://10.86.8.132:8282") svr.start_storm_server() #Start STB browser svr.press_CC_key() #step1:input correct user name step1 = "document.getElementById('username_field').value='demo'" if not soket_login.send_data_to_client(step1): print "command send fail \t input user name" return False if soket_login.get_data_from_client().find("demo") == -1: print "command get fail \t input user name" return result += "Step1\tinput user name\t\tpass\n" time.sleep(2) #step2:input correct password step2 = "document.getElementById('password_field').value = 'mode'" if not soket_login.send_data_to_client(step2): print "command send fail \t input password" return False if soket_login.get_data_from_client().find("mode") == -1: print "command get fail \t input password" return False result += "Step2\tinput password\t\tpass\n" time.sleep(2) #step3:click login button step3 = "document.getElementById('login_button').click()" soket_welcom_page = webSocketThread(82) if not soket_login.send_data_to_client(step3): print "command send fail \t click login button" return False result += "Step3\tclick login button\tpass\n" soket_login.get_data_from_client() soket_login.close_dead_connection() #step4:get login page title step4 = "document.getElementById('welcome').textContent" if not soket_welcom_page.send_data_to_client(step4): print "command send fail \t get page title" return False result += "Step4\tget login page title\tpass\n" #step5:check login page title if soket_welcom_page.get_data_from_client().find("Welcome Page")==-1: print "command get fail \t check page title" return False result += "Step5\tcheck login page title\tpass\n" soket_welcom_page.close_active_connection() print result svr.press_Exit_key() svr.stop_storm_server() print 'complete test'
''' Created on 2014-9-12 @author: Administrator ''' from xmlrpclib import ServerProxy svr=ServerProxy("http://10.86.8.132:8282") svr.start_storm_server() svr.press_CC_key() svr.stop_storm_server()