# coding:utf-8 import smtplib import time from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from util.log.mylog import log from common import readconfig import sys, os Path = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(Path)[0] sys.path.append(rootPath) # 测试报告的路径 reportPath = readconfig.report_path logger = log() # 配置收发件人 recvaddress = [ '*****@*****.**', ] # 163的用户名和密码 sendaddr_name = '*****@*****.**' sendaddr_pswd = 'WRTLUABQRZEOMHFS' class SendMail: def __init__(self, recver=None): """接收邮件的人:list or tuple""" if recver is None: self.sendTo = recvaddress else: self.sendTo = recver
#游戏社区发布资讯 import os, sys from common.tools import WebTools from common.readconfig import r from common.raiseout import raiseout from util.log import mylog as m from time import sleep l = m.log() class community: def __init__(self): self.d = WebTools() self.d.Getwebpage(r.get_http('url')) l.info("进入主页==>> {}".format(r.get_http('url'))) self.d.driver.maximize_window() sleep(2) def send(self): #发布资讯 self.d.Click( "xpath", '//*[@id="app"]/div[1]/div[2]/section/div/a[6]/div/div/div[2]') l.info("进入国内社区") self.d.Current_handel() self.d.switch_window("游戏社区Admin") sleep(1) self.d.Click( 'xpath', '//*[@id="app"]/div/div[2]/section/div/section/form/div[8]/div/div/button' ) l.info("发布资讯")
def raiseout(): log().debug( "This is a debug log.") with open(log().logname, 'a+') as f: f.writelines(traceback.format_exc())
def tearDownClass(cls): log().info('******************** 测试结束 ********************')
def setUpClass(cls): log().info('******************** OA测试开始 ********************')
def setUpClass(cls): log().info('******************** 舆论管理测试开始 ********************')