def _getSession(self): """获取已登录账号的requests.session对象""" try: session_mongo = singleMongo.sessionMongo session_dict = session_mongo.find_one({'_id': USERNAME}, { '_id': 0, 'session_pyobj': 1 }) except Exception as e: logger.exception(e) raise Exception('<进程终止> mongodb ERROR') if session_dict is not None: # redis中存在session self.s = pickle.loads(session_dict['session_pyobj']) logger.info('从mongodb获取账号{}的requests.session对象:{}'.format( USERNAME, self.s)) else: # redis中不存在/报错 重新建立session logger.info('账号:{}的requests.session对象已过期,重新登录获取'.format(USERNAME)) l = Login() self.s = l.session() try: l.saveSession(self.s) except: logger.warn( 'mongodb连接异常:无法保存账号{}的requests.session对象到mongodb中'.format( USERNAME, self.s))
def setUpClass(cls): cls.Login = Login() cls.Login.login() cls.driver = cls.Login.driver cls.driver.get(url[0] + 'app/formmain/add?groupid=') sleep(1) cls.driver.find_element_by_id('sl').click() cls.formid = BasicAction.preview(cls.driver)
def setUpClass(cls): cls.Login = Login() cls.Login.login() cls.driver = cls.Login.driver cls.driver.get(url[0] + 'app/formmain/add?groupid=') sleep(1) cls.driver.find_element_by_id('gd2').click() cls.driver.find_element_by_id("addNoImgGoods").click() cls.driver.find_element_by_class_name('goods-name-view').click() SettingOptUtils.pgoods(cls.driver) cls.formid = BasicAction.preview(cls.driver)
def setUpClass(cls): cls.Login = Login() cls.Login.login() cls.driver = cls.Login.driver cls.driver.get(url[0] + 'app/formmain/add?groupid=') sleep(1) cls.driver.find_element_by_id('sl').click() cls.formid = BasicAction.preview(cls.driver) cls.driver.get(url[0] + 'app/formmain/' + cls.formid + '?setstep=2') cls.driver.find_element_by_css_selector('[menuindex="m04"]').click() cls.driver.switch_to_frame('settingform') cls.set(cls)
def setUpClass(cls): cls.Login = Login() cls.Login.login() cls.driver = cls.Login.driver cls.driver.get(url[0] + 'app/formmain/add?groupid=') sleep(1) cls.driver.find_element_by_id('drag_text').click() cls.driver.find_element_by_id('nb').click() BasicAction.preview(cls.driver) for i in range(3): cls.driver.find_element_by_name("F2_number").send_keys( random.randint(1, 10)) cls.driver.find_element_by_id("tmpid").send_keys( random.randint(1, 10)) cls.driver.find_element_by_id('btnSubmit').click() cls.driver.refresh() cls.driver.close()
def setUpClass(cls): cls.Login = Login() cls.Login.login() cls.driver = cls.Login.driver cls.driver.get(url[0]+'app/formmain/add?groupid=') sleep(0.5) cls.driver.find_element_by_id("formName").clear() cls.driver.find_element_by_id("formName").send_keys("测试表单关联1") cls.driver.find_element_by_id('sl').click() cls.formid = BasicAction.preview(cls.driver) cls.driver.find_element_by_css_selector('[name="F1"]').send_keys(10) cls.driver.find_element_by_id('btnSubmit').click() cls.driver.close() cls.driver.switch_to.window(cls.driver.window_handles[0]) cls.driver.get(url[0]+'app/formmain/add?groupid=') sleep(0.5) cls.driver.find_element_by_id("formName").clear() cls.driver.find_element_by_id("formName").send_keys("测试表单关联2") cls.driver.find_element_by_id('sl').click() cls.formid = BasicAction.preview(cls.driver) sleep(0.5) cls.driver.find_element_by_id('btnSubmit').click()
def setUpClass(cls): cls.Login = Login() cls.Login.login() cls.driver = cls.Login.driver