static void GoogleLogin(BrowserOp browser, string userName, string PWD) { HyperLinkOp.LinkClick(browser, "登录"); EditOp.EditInput(browser, "Email", userName); EditOp.EditInput(browser, "Passwd", PWD); ButtonOp.buttonClick(browser, "PersistentCookie"); ButtonOp.buttonClick(browser, "signIn"); if (browser.AssertStringinSourceCode("您输入的用户名或密码不正确")) { Console.WriteLine("Login Failed"); } else if (browser.AssertStringinSourceCode("请输入密码")) { MessageBox.Show("please input your password"); } else if (browser.AssertStringinSourceCode("请输入电子邮件地址")) { Console.WriteLine("please input your account"); } else if (browser.AssertStringinSourceCode("输入上图中显示的字母")) { Console.WriteLine("My God!"); } }
public static void OdomainAddNotification(BrowserOp browser) { ButtonOp.buttonClick(browser, "//a[1]/img"); ButtonOp.buttonClick(browser, "//tr[@id='menu21']/td/a/img"); browser.SwitchFrame("cfrm"); ButtonOp.buttonClick(browser, "//a[@id='profileNoticeAdd']/img"); EditOp.EditInput(browser, "noticeName", "test"); RadioOp.RadioSelect(browser, "remindUser", "true"); EditOp.EditInput(browser, "userNotice", "ivangeng"); ButtonOp.buttonClick(browser, "imageField"); Console.WriteLine(browser.AssertStringinSourceCode("成功创建")); }
static void TestPortalAddUser(BrowserOp browser, string userName, string PWD) { HyperLinkOp.LinkClick(browser, "用户信息管理"); ButtonOp.buttonClick(browser, "A13"); ButtonOp.buttonClick(browser, "//input[@value='添加包测试用户']"); EditOp.EditInput(browser, "username", userName); EditOp.EditInput(browser, "password", PWD); EditOp.EditInput(browser, "confirmpassword", PWD); ButtonOp.buttonClick(browser, "Submit"); Utility.wait(5); if (browser.AssertStringinSourceCode("您添加的用户已经存在系统中")) { Console.WriteLine("User existed!"); } else { Console.WriteLine("Add success"); } }