Web自动化 pageObject 企业微信自动化实战

admin 2025-04-29 197人围观 ,发现175个评论
获取登录用户的cookie

企业微信地址:

选择copyascurl

执行获取到cookie

使用awk分割cookie

echo""|awk'BEGIN{RS=";";FS="="}{print"().addCookie(newCookie(\""$1"\",\""$2"\"));"}'

echo""|awk'BEGIN{RS=";";FS="="}{print"().addCookie(newCookie(\""$1"\",\""$2"\")

使用seleniumIDE录制企业微信添加联系人的步骤

编写代码:

微信网页端主页

微信网页端联系人:

父类公共方法:

packagetest_;;;;;;;/***@param*@Auther:zhangcheng*@Date:2020/8/3123:07*@Description:共用方法抽取*/publicclassBasePage{RemoteWebDriverdriver;WebDriverWaitwait;publicBasePage(){driver=newChromeDriver();().timeouts().implicitlyWait(5,);}publicBasePage(RemoteWebDriverdriver){=driver;}//抽取公用退出publicvoidquit(){();}//find方法抽取publicvoidclick(Byby){//todo异常处理(by).click();}//提取skeys方法publicvoidsKeys(Byby,Stringcontent){//todo异常处理((by));(by).sKeys(content);}//提取上传方法publicvoidupload(Byby,Stringpath){((by));(by).sKeys(path);}}

测试类:

;;;;importtest_;importtest_;;/***@param*@Auther:zhangcheng*@Date:2020/8/3108:07*@Description:*/publicclasstestContact{staticMainPagemain;staticContactPagecontact;@BeforeAllstaticvoidbeforeAll(){main=newMainPage();contact=();}@TestvoidtestAddmerber(){StringuserName=("3","3","").search("3").getUserName();assertEquals(userName,"3");}@TestvoidimportFromFile(){(().getResource("通讯录批量导入模板.xlsx"));}@AfterAllpublicstaticvoidafterAll(){try{(3000);}catch(InterruptedExceptione){();}();}}
猜你喜欢
    不容错过