예제 #1
0
def test_card():
    driver = webdriver.Firefox()
    driver.implicitly_wait(30)
    test_enviroment = 'omega'
    base_url = "http://www."+test_enviroment+".ablesky.com/"
    
    user_name = 'ibm'
    user_psw = '1234' 
    org_name = user_name
    
    cfg_file = 'config.ini'
    cfg = ConfigParser.RawConfigParser()
    cfg.read(cfg_file)
    
    login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)     
    card = xlrd.open_workbook('D:\\PaymentCardList-201210221522.xls' )     
    table = card.sheet_by_index(0) 
            #list_ran = []
            #for ran in range(1002):
             #   rand_num = random.randint(2,40001)
              #  list_ran.append(rand_num)
            
    for j in range(1002):
        if j < 2:
            continue
        card_num = table.cell(j,0).value
        card_psw = table.cell(j,1).value 
        try:
            card_management.use_prepaid_card(cfg, driver, base_url, card_num, card_psw)
        except:
            print card_num,card_psw
예제 #2
0
    def login_from_index(self):

        self.total += 1
        try:
            login.login_by_logindo(self.cfg, self.driver, self.base_url, self.org_name, self.org_password)
        except Exception, e:
            print traceback.format_exc()
def admin_athority_check():
    
    global base_url
    global cfg 
    global driver
    base_url = "http://www.beta.ablesky.com/"
    # base_url = "http://www.ablesky-a.com:8080/"
    cfg_file = 'config.ini'
    cfg = ConfigParser.RawConfigParser()
    cfg.read(cfg_file)
    # user_name = "v52"
    # user_psw = "1234"    
    user_name = "offcn"
    user_psw = "1234"

    chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
    os.environ["webdriver.chrome.driver"] = chromedriver
    driver = webdriver.Chrome(chromedriver)
    login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)
    driver.get("%smyOffice.do" %(base_url))
    driver.maximize_window() #窗口最大化

    #后台-先创建管理员    
    create_manage()
    driver.quit()
예제 #4
0
def admin_athority_check():
    
	global base_url
	global cfg 
	global driver
	base_url = "http://www.beta.ablesky.com/"
	cfg_file = 'config.ini'
	cfg = ConfigParser.RawConfigParser()
	cfg.read(cfg_file)
	user_name = "sadm001"
	user_psw = "1234"

	chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
	os.environ["webdriver.chrome.driver"] = chromedriver
	driver = webdriver.Chrome(chromedriver)
	# driver = webdriver.Ie()
	driver.maximize_window() #窗口最大化

	login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)
	#教学教务
	course()
	class_center()
	onlineclass()
	exam_manage()
	cheap_course()
	teacher()

	#财务/交易39
	financial()
	transaction()

	#其他
	member()
	ad_system()
	course_lecture()
예제 #5
0
 def use_listencard(self):#试听卡
     
     self.total += 1
     try:
         if self.l_card_num != 0 and self.l_card_pwd != 0:
             login.login_by_logindo(self.cfg, self.driver, self.base_url, self.l_card_num, self.l_card_pwd)
         else:
             print u"没有获取到试听卡号或者密码"
     except Exception, e:
         print traceback.format_exc() 
         self.verificationErrors.append('fail to use listen card!')
 def test_use_listencard(self):
    l_card_num = self.cfg.get("env_para", "l_card_num")
    l_card_pwd = self.cfg.get("env_para", "l_card_pwd")
    if l_card_num != 0 and l_card_pwd != 0:
        login.login_by_logindo(self.cfg, self.driver, self.base_url, l_card_num, l_card_pwd)
    else:
        print u"没有获取到试听卡号或者密码"
        
    time.sleep(2)     
    confirm_ok = self.driver.execute_script("return $('.mode-selected').text()")
    ba = Base(self.driver)
    filename = ba.save_screenshot()
    print "image:"+filename
    self.assertEqual(u"绑定手机", confirm_ok)
    def setUp(self):

        self.cfg_file = 'config.ini'
        self.cfg = ConfigParser.RawConfigParser()
        self.cfg.read(self.cfg_file)
        self.browser = self.cfg.get("env_para", "browser")
        self.org_name = self.cfg.get("env_para", "org_name")
        self.org_password = self.cfg.get("env_para", "org_password")
        self.user_name = self.cfg.get("env_para", "user_name")
        self.user_password = self.cfg.get("env_para", "user_password")
        self.base_url = self.cfg.get("env_para", "base_url")
        self.dbhost = self.cfg.get("env_para", "dbhost")

        #注册的时候会把第一个值赋给它
        self.import_name = ""

        if os.path.exists("C:\\test_rs_pic") != True:
                os.system("mkdir C:\\test_rs_pic")

        if self.browser == 'ie':
            self.driver = webdriver.Ie()
        elif self.browser == 'firefox':
            self.driver = webdriver.Firefox()
        elif self.browser == 'Chrome':
            # chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
            # os.environ["webdriver.chrome.driver"] = chromedriver
            # self.driver = webdriver.Chrome(chromedriver)
            self.driver = webdriver.Chrome()
        elif self.browser == "Html":
            self.driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNIT.copy())
        else:
            self.driver = webdriver.Ie()

        self.driver.implicitly_wait(3)
        self.driver.maximize_window()
        self.driver.get(self.base_url)

        cookie1 = self.cfg.get('env_para', 'cookie1')
        if(cookie1 == 'no'):
            login.login_by_logindo(self.cfg, self.driver, self.base_url, self.org_name, self.org_password)
            self.cfg.set("env_para", "cookie1", str(self.driver.get_cookie('ASUSS')['value']))
            self.cfg.write(open(self.cfg_file, "w"))
           
            #本来还有一个叫RM的cookie,但是值都是rm不变所以不取了
            # path=/; domain=.ablesky.com
        else:
            self.driver.add_cookie({'name':'ASUSS', 'value':cookie1, 'path':'/', 'domain':'.ablesky.com'})
            self.driver.add_cookie({'name':'RM', 'value':'rm'})
def test_create_student():
    
    test_enviroment = "omega"        
    cfg_file = 'config.ini'
    cfg = ConfigParser.RawConfigParser()
    cfg.read(cfg_file)  

    base_url = "http://www."+test_enviroment+".ablesky.com/"
    driver = webdriver.Firefox()
    #driver.implicitly_wait(30)
    user_name = "zhongyan"
    user_psw = "1234"
    for i in range(5):
        driver = webdriver.Firefox()
        stu_num = 200
        login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)
        student_management.auto_create_student(cfg, driver, base_url, user_name, stu_num)
        driver.quit()
def admin_athority_check():
	
	global base_url
	global cfg 
	global driver
	base_url = "http://www.gamma.ablesky.com/"
	cfg_file = 'config.ini'
	cfg = ConfigParser.RawConfigParser()
	cfg.read(cfg_file) 
	user_name = "stu_gy00"
	user_psw = "gy0411"
	
	chromedriver = "C:\Users\Administrator\AppData\Local\Google\Chrome\Application\chromedriver.exe"
	os.environ["webdriver.chrome.driver"] = chromedriver
	driver = webdriver.Chrome(chromedriver)
	#driver = webdriver.Ie()

	login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)
	# driver.get("%smyOffice.do" %(base_url))
	
	# ##(fore_stage())
	time.sleep(1)
	driver.find_element_by_link_text(u"网校首页").click()
	time.sleep(1)
	# firstpage()#首页
	# course_center_relate()#课程中心
	# class_center_relate()#报班中心 
	time.sleep(1)
	driver.find_element_by_link_text(u"网校首页").click()
	time.sleep(1) 
	online_ansquestion()#在线答疑
	time.sleep(1)
	driver.find_element_by_link_text(u"网校首页").click()
	time.sleep(1)
	live_course_relate()#直播课程
	# cheap_course_relate()#特惠课程
	# online_exam_relate()#在线考试
	# school_notice()#网校公告
	# teacher_team()#名师团队
	# school_members()#网校成员
	# about_us()#关于我们
	# help_center()#帮助中心
	
	driver.quit()
def admin_athority_check():
    
	global base_url
	global cfg 
	global driver
	base_url = "http://www.gamma.ablesky.com/"
	cfg_file = 'config.ini'
	cfg = ConfigParser.RawConfigParser()
	cfg.read(cfg_file) 

	user_name = "stu_lr01"
	user_psw = "gy0411"

	chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
	os.environ["webdriver.chrome.driver"] = chromedriver
	driver = webdriver.Chrome(chromedriver)
	#driver = webdriver.Ie()
	driver.maximize_window() #窗口最大化

	login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)
	# driver.get("%smyOffice.do" %(base_url))

	# #后台-先创建管理员	
	# create_manage()

	#后台-后台首页
	# teaching()#教学互动
	# authmanage()#授权管理
	# courseagent()#课程合作代理
	# learnigcard()#学习卡
	# countmanage()#统计管理

	# #后台-系统设置
	manageorservice()#管理员/客服
	# pagecreate()#页面建设

	# #后台-学员/员工
	stuoremp()#网校学员
예제 #11
0
 def testName(self):
     
     #登录
     login.login_by_logindo(self.cfg, self.driver, self.base_url, self.org_name, self.org_password)
     
 
     for i in range(1000):
         try:
             rand_name = str(random.randint(1000,9999))
             title =u"course"+rand_name  
             # 发单视频        
             new_course_management.course_redirect(self.cfg, self.driver, self.base_url, course_title=title)
             #三分屏
             title =u"threecourse"+rand_name
             new_course_management.course_redirect(self.cfg, self.driver, self.base_url, isthree=1, course_title=title)
         except UnexpectedAlertPresentException:
             self.driver.switch_to_alert().accept()
             traceback.print_exc()
             print i
             continue
         except Exception:
             traceback.print_exc()
             print i
             continue
def test_create_student():
    
    test_enviroment = "beta"        
    cfg_file = 'config.ini'
    cfg = ConfigParser.RawConfigParser()
    cfg.read(cfg_file)  

    base_url = "http://www."+test_enviroment+".ablesky.com/"
    driver = webdriver.Ie()
    stu_txt = r"C:\register_user_list.txt"
    #driver.implicitly_wait(30)
    user_name = "salesdemo"
    user_psw = "1234"
    org_name = user_name
    exam_name = u'未作答(主观+客观,收费)'
    for i in range(1):
        print 'wwwwwwwwwwwwwwwwwwwwwww'
        #chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
        #os.environ["webdriver.chrome.driver"] = chromedriver
        #driver =  webdriver.Chrome(chromedriver)
        stu_num = 2
        #login.auto_register(cfg, driver, base_url, 2, 1)
        login.login_by_logindo(cfg, driver, base_url, user_name, user_psw)
        #student_management.buy_open_num(cfg,driver, base_url, org_name, bnum=1)
        #student_management.import_one_student(cfg,driver, base_url, org_name, stu_name="sunmin1990")
        time.sleep(5)
        #new_course_management.class_redirect(cfg, driver, base_url)
        #student_management.open_course_for_one(cfg,driver,base_url, org_name,stu_num = 1)
        #student_management.open_course_for_multi(cfg,driver,base_url, org_name)
        #student_management.manage_course_num(cfg, driver, base_url)
        #exam_paper.send_close_paper(cfg, driver, base_url, atype=1)
        #exam_paper.exam_result(cfg, driver, base_url, exam_name, etype=1, username="******")
        #exam_paper.exam_result(cfg, driver, base_url, exam_name, etype=2, username="******")
        #exam_paper.exam_result(cfg, driver, base_url, exam_name, etype=3, username="******")
        exam_paper.send_close_paper(cfg, driver, base_url, atype=1)
        exam_paper.send_close_paper(cfg, driver, base_url, atype=2)
예제 #13
0
    def login_user(self):

        try:
            login.login_by_logindo(self.cfg, self.driver, self.base_url, self.user_name, self.user_password)
        except Exception, e:
            print traceback.format_exc()