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 void TestCMCCTestPortal(BrowserOp browser) { XMLUtility xml = new XMLUtility("./TestPortal.xml"); string userName = xml.readNodeValue("UserName"); string pwd = xml.readNodeValue("PWD"); string manufacturer = xml.readNodeValue("manufacturer"); string model = xml.readNodeValue("model"); string packageType = xml.readNodeValue("packageType"); string packageStatus = xml.readNodeValue("packageStatus"); EditOp.EditInput(browser, "mobile", userName); EditOp.EditInput(browser, "password", pwd); ButtonOp.buttonClick(browser, "submit"); Utility.wait(5); HyperLinkOp.LinkClick(browser, "包管理"); //ButtonOp.buttonClick(browser, "A16"); ButtonOp.buttonClick(browser, "//input[@id='A16' and @value='固件更新包管理']"); Utility.wait(1); ComboBoxOp.ComboBoxItemSelect(browser, "manufacturer", manufacturer); Utility.wait(1); ComboBoxOp.ComboBoxItemSelect(browser, "model_name", model); Utility.wait(1); ComboBoxOp.ComboBoxItemSelect(browser, "packageType", packageType); Utility.wait(1); ComboBoxOp.ComboBoxItemSelect(browser, "packageStatus", packageStatus); ButtonOp.buttonClick(browser, "submit2"); }
static void TestSelfCare(BrowserOp browser) { EditOp.EditInput(browser, "mobile", "root"); EditOp.EditInput(browser, "password", "111111"); ButtonOp.buttonClick(browser, "submit"); Utility.wait(2); HyperLinkOp.LinkClick(browser, "客户问题"); Utility.wait(5); ButtonOp.buttonClick(browser, "start"); Utility.wait(5); ButtonOp.buttonClick(browser, "//div[3]/table/tbody/tr[1]/td[4]"); }
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"); } }
public static void TestIE() { BrowserOp browser = new BrowserOp("www.hp.com", BrowserType.IE); HyperLinkOp.LinkClick(browser, "Company Information"); }