public void YongHuXinXi001() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证个人中心菜单收起 Log.Info("验证个人中心菜单默认收起"); Boolean flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyAccount")); CtripAssert.AreEqual(driver, flag.ToString(), "False", "个人中心菜单默认收起"); //验证个人中心菜单展开 Log.Info("验证个人中心菜单展开"); driver.FindElement(By.Id("menu_person_icon_id")).Click(); Thread.Sleep(MinSleepTime); flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyAccount")); CtripAssert.AreEqual(driver, flag.ToString(), "True", "个人中心菜单已展开"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void LianJieYanZhengCase006() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证旅游分享链接存在并点击 Log.Info("应用中心旅游分享链接验证"); driver.FindElement(By.XPath("//ul/li/div[2]/dl[4]/dt/span")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_TripShare")).Click(); Bcom.SwitchPage(driver); Thread.Sleep(MIDSleepTime); //验证跳转链接正确 CtripAssert.Contains(driver, driver.Url.ToString(), "http://travel.testp.sh.ctriptravel.com/uid-aM00018803-kongjian", "验证链接跳转"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void DianPingTiXingCase003() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MaxSleepTime); //验证待点评订单数 Log.Info("验证待点评订单数"); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[1]/ul/li[4]/a[3]")).Text, UserHT["待点评订单数"].ToString(), "验证待点评订单数"); //验证待点评订单跳转 Log.Info("验证待点评订单跳转"); driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[1]/ul/li[4]/a[3]")).Click(); Thread.Sleep(MaxSleepTime); CtripAssert.Contains(driver, driver.Url.ToString(), "orderstatus=15", "验证待点评订单跳转"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void LianJieYanZhengCase003() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证会员互动模块 Log.Info("验证会员互动模块"); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/dl")).Text, "会员互动", "验证模块完整"); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/dl")).Text, "携程贵宾俱乐部", "验证链接一存在"); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/dl")).Text, "积分奖励活动专区", "验证链接二存在"); //验证链接跳转 /*Log.Info("验证链接跳转"); * driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[1]/ul/li[4]/a[1]")).Click(); * Thread.Sleep(5000); * CtripAssert.Contains(driver, driver.Url.ToString(), "orderstatus=4", "验证未提交订单跳转"); * */ } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void LianJieYanZhengCase007() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //打开悬浮菜单 Log.Info("打开更多悬浮菜单"); IWebElement ele = driver.FindElement(By.Id("a_moreLink")); new Actions(driver).MoveToElement(ele).Perform(); driver.FindElement(By.LinkText("特卖汇")).Click(); Thread.Sleep(MIDSleepTime); //验证跳转链接正确 CtripAssert.AreEqual(driver, driver.FindElement(By.ClassName("pkg")).Text, "特卖机票", "验证链接跳转"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi008() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证第三方账号绑定链接存在并点击 Log.Info("个人中心第三方账号绑定链接"); driver.FindElement(By.XPath("//ul/li/div[2]/dl[2]/dt/span")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_ThirdBind")).Click(); //证书判断 if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); Thread.Sleep(3000); } Thread.Sleep(MinSleepTime); //验证跳转链接正确 CtripAssert.Contains(driver, driver.FindElement(By.XPath("//div[@class='breadcrumb']")).Text, "第三方账号绑定", "验证跳转链接是否正确"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void LianJieYanZhengCase005() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证电子账单链接存在并点击 Log.Info("应用中心电子账单链接验证"); driver.FindElement(By.XPath("//ul/li/div[2]/dl[4]/dt/span")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_ElectBill")).Click(); Thread.Sleep(MinSleepTime); //验证跳转链接正确 CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[2]/div[1]/strong")).Text, "电子账单", "验证跳转链接是否正确"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void DianPingChaXunCase001() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MIDSleepTime); //订单页面跳转 Log.Info("订单页面跳转"); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_HotelOrder")).Click(); Thread.Sleep(MinSleepTime); Log.Info("选择国内酒店"); SeleniumFun.SelectByText(driver.FindElement(By.Id("ddl_orderRange")), "国内酒店"); Log.Info("返回订单查询结果"); driver.FindElement(By.Id("btn_search")).Click(); Thread.Sleep(MinSleepTime); Log.Info("点击具体订单"); driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/table/tbody/tr[1]/td[2]")).Click(); Bcom.SwitchPage(driver); SeleniumFun.CheckSecurity(driver); Thread.Sleep(MIDSleepTime); //验证跳转页面正确 CtripAssert.Contains(driver, driver.FindElement(By.ClassName("mem_location")).Text, "酒店订单", "验证跳转页面"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void DianPingChaXunCase010() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MIDSleepTime); //订单页面跳转 Log.Info("订单页面跳转"); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_TicketOrder")).Click(); Thread.Sleep(MIDSleepTime); Log.Info("等待订单查询结果"); Log.Info("点击具体订单"); driver.FindElement(By.XPath("//ul/li/div[3]/div[3]/div[2]/div/table/tbody/tr/td[2]")).Click(); Bcom.SwitchPage(driver); SeleniumFun.CheckSecurity(driver); Thread.Sleep(MaxSleepTime); //验证跳转页面 CtripAssert.Contains(driver, driver.FindElement(By.ClassName("od_state")).Text, "礼品卡订单详情", "验证跳转页面"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi013() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证我的信用卡链接存在并点击 Log.Info("验证我的信用卡链接"); driver.FindElement(By.Id("menu_person_icon_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyCard")).Click(); //证书判断 SeleniumFun.CheckSecurity(driver); Thread.Sleep(MinSleepTime); //验证列表显示正常 CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/table/tbody/tr[1]/td[2]")).Text, "中国招商银行", "验证列表显示正常"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void DingDanGuanLiCase001() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(5000); //验证订单管理菜单展开,其他菜单收起 Log.Info("验证订单管理菜单展开"); Boolean flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_ALLOrder")); CtripAssert.AreEqual(driver, flag.ToString(), "True", "我的订单菜单已展开"); flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyAccount")); CtripAssert.AreEqual(driver, flag.ToString(), "False", "个人中心菜单未展开"); flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_Passenger")); CtripAssert.AreEqual(driver, flag.ToString(), "False", "常用信息管理菜单未展开"); flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyAccount")); CtripAssert.AreEqual(driver, flag.ToString(), "False", "应用中心菜单未展开"); //点击其他菜单,收起订单管理菜单 driver.FindElement(By.XPath("//ul/li/div[2]/dl[2]/dt/span")).Click(); //验证订单管理菜单已收起 flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_ALLOrder")); CtripAssert.AreEqual(driver, flag.ToString(), "False", "我的订单菜单已收起"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void DingDanGuanLiCase010() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(5000); //验证订单管理游票菜单链接存在并点击 Log.Info("验证订单管理游票订单链接"); driver.FindElement(By.XPath("html/body/form/ul/li/div[2]/dl[1]/dd[9]/a")).Click(); Thread.Sleep(MinSleepTime); //验证跳转链接正确 CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[3]/div[1]/h3")).Text, "待完成的礼品卡订单", "验证跳转链接是否正确"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void MemberLoginCase001() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["钻石登录名"].ToString(), UserHT["钻石密码"].ToString()); /*请勿绑定手机 * //验证用户登录名 * Log.Info("验证用户登录名"); * CtripAssert.Contains(driver, driver.FindElement(By.XPath("//div[3]/div/div/ul/li/a")).Text, UserHT["钻石登录名"].ToString(), "验证用户登录名"); */ //验证登录是否成功 Log.Info("验证退出链接"); CtripAssert.AreEqual <string>(driver, driver.FindElement(By.LinkText("退出")).Text, "退出", "验证退出链接"); //验证会员等级 Log.Info("验证会员等级"); CtripAssert.AreEqual <string>(driver, driver.FindElement(By.ClassName("mc_grade")).Text, "钻石贵宾", "验证会员等级"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void LianJieYanZhengCase001() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证应用中心菜单收起 Log.Info("验证应用中心菜单默认收起"); Boolean flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_FlightTool")); CtripAssert.AreEqual(driver, flag.ToString(), "False", "应用中心菜单默认收起"); //验证应用中心菜单展开 Log.Info("验证应用中心菜单展开"); driver.FindElement(By.XPath("//ul/li/div[2]/dl[4]/dt/span")).Click(); Thread.Sleep(MinSleepTime); flag = SeleniumFun.IsVisible(driver, By.Id("ctl00_MainContentPlaceHolder_PageLeft1_FlightTool")); CtripAssert.AreEqual(driver, flag.ToString(), "True", "应用中心菜单已展开"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi012() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证常用地址信息链接存在并点击 Log.Info("验证常用旅客信息链接"); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_menu_manage_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_UsefulAddress")).Click(); //证书判断 if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); Thread.Sleep(3000); } Thread.Sleep(MinSleepTime); //验证列表显示正常 driver.FindElement(By.Id("txt_keyword")).SendKeys("公司"); driver.FindElement(By.Id("bt_Search")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[2]")).Text, "公司", "验证列表显示是否正常"); //修改常用地址 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[9]/a[1]")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("txt_Rep")).Clear(); driver.FindElement(By.Id("txt_Rep")).SendKeys("令狐冲"); driver.FindElement(By.Id("bt_SaveAdd")).Click(); driver.FindElement(By.Id("input_pwd_check")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.ClassName("btn_l3")).Click(); Thread.Sleep(MinSleepTime); //验证修改是否成功 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[9]/a[1]")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.Id("txt_Rep")).GetAttribute("value"), "令狐冲", "修改成功"); //数据回滚 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr/td[9]/a[1]")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("txt_Rep")).Clear(); driver.FindElement(By.Id("txt_Rep")).SendKeys("测试"); driver.FindElement(By.Id("bt_SaveAdd")).Click(); driver.FindElement(By.Id("input_pwd_check")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.ClassName("btn_l3")).Click(); Thread.Sleep(MinSleepTime); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void DingDanGuanLiCase002() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(5000); //验证订单管理全部订单链接存在并点击 Log.Info("验证订单管理全部订单链接"); driver.FindElement(By.XPath("//ul/li/div[2]/dl[1]/dd[1]/a")).Click(); Thread.Sleep(MinSleepTime); //验证跳转链接正确 CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[3]/div[1]/h3")).Text, "待完成的订单", "验证跳转链接是否正确"); //设置时间区间显示订单数 TestLog.WriteLine("验证不同时间区间订单显示"); TestLog.WriteLine("检查已完成订单"); TestLog.WriteLine("检查最近一个月已完成订单数"); String notendtext = driver.FindElement(By.Id("h3_contianerF")).Text; int flagA = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1)); CtripAssert.IsTrue(driver, flagA >= 0); TestLog.WriteLine("检查最近三个月已完成订单数"); SeleniumFun.SelectByText(driver.FindElement(By.Id("sel_orderrange")), "最近3个月订单"); Thread.Sleep(MIDSleepTime); int flagB = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1)); CtripAssert.IsTrue(driver, flagB >= flagA); TestLog.WriteLine("检查最近一年已完成订单数"); SeleniumFun.SelectByText(driver.FindElement(By.Id("sel_orderrange")), "最近1年订单"); Thread.Sleep(MIDSleepTime); int flagC = int.Parse(notendtext.Substring(notendtext.IndexOf('(') + 1, notendtext.IndexOf(')') - notendtext.IndexOf('(') - 1)); CtripAssert.IsTrue(driver, flagC >= flagA); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi003() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证我的积分链接存在并点击 Log.Info("个人中心我的积分链接验证"); driver.FindElement(By.Id("menu_person_icon_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyMileage")).Click(); //证书判断 SeleniumFun.CheckSecurity(driver); Thread.Sleep(MIDSleepTime); //验证跳转链接正确 CtripAssert.Contains(driver, driver.FindElement(By.XPath("//form/ul/li/div[1]")).Text, "我的积分", "验证跳转链接是否正确"); //验证兑换记录列表 driver.FindElement(By.Id("btnExchangeHistory")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("inputSearchExchangLog")).SendKeys("2575"); driver.FindElement(By.Id("btnSearch")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[3]/div[1]/table/tbody/tr/td[2]")).Text, "积分优化换游票525", "验证兑换记录列表显示正确"); //验证积分明细列表 driver.FindElement(By.Id("btnMileageDetail")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div[1]/table/tbody/tr[1]/td[1]")).Text, "2013-04-12", "验证积分明细列表显示正确"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi006() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证我的点评链接存在并点击 Log.Info("个人中心消息提醒链接"); driver.FindElement(By.Id("menu_person_icon_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MessageRemind")).Click(); //证书判断 if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); Thread.Sleep(3000); } Thread.Sleep(MinSleepTime); //验证列表显示正确 driver.FindElement(By.Id("txt_Key")).SendKeys("奖品"); driver.FindElement(By.Id("bt_Search")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div[2]/table/tbody/tr[1]/td[2]")).Text, "申领奖品", "验证消息列表显示正确"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi011() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证常用旅客信息链接存在并点击 Log.Info("验证常住酒店链接"); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_menu_manage_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_UsualHotel")).Click(); //证书判断 if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); Thread.Sleep(3000); } Thread.Sleep(MinSleepTime); //验证列表显示正常 driver.FindElement(By.Id("txt_keyword")).SendKeys("6+1"); driver.FindElement(By.Id("bt_Search")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/table/tbody/tr/td[2]/a")).Text, "6+1酒店连锁(上海陆家嘴店)(原路依斯康商务酒店)", "列表显示正常"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void PiaoQuanXinXiCase001() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(5000); //验证酒店消费卷余额 Log.Info("验证酒店消费券余额"); string Balance000 = driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[2]")).Text.ToString(); CtripAssert.AreEqual(driver, Balance000, UserHT["酒店消费券余额"].ToString(), "验证酒店消费券余额"); //验证酒店消费券链接跳转 Log.Info("验证酒店消费券跳转"); //driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[2]")).Click(); driver.Navigate().GoToUrl("https://sinfo.testp.sh.ctriptravel.com/Balance/zh-cn/Coupon.aspx?type=tab"); if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); } Thread.Sleep(5000); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul[1]/li[1]")).Text, "消费券余额", "验证消费券跳转"); //验证跳转后数据与跳转前相同 CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul[1]/li[1]/span/em")).Text, Balance000, "验证消费券跳转余额"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void PiaoQuanXinXiCase002() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver, LogWrite); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(15000); //验证抵用券余额 Log.Info("验证抵用券余额"); string Balance001 = driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[3]")).Text.ToString(); CtripAssert.AreEqual(driver, Balance001, UserHT["抵用券余额"].ToString(), "验证抵用券余额"); //验证抵用券链接跳转 Log.Info("验证抵用券跳转"); driver.FindElement(By.XPath("//ul/li/div[3]/div[1]/div[3]/a[3]")).Click(); if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); } Thread.Sleep(5000); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul/li[1]")).Text, "可用金额", "验证抵用券跳转"); //验证跳转后数据与跳转前相同 CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div/ul/li[1]/span[1]/em")).Text, Balance001, "验证抵用券跳转余额"); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi010() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //验证常用旅客信息链接存在并点击 Log.Info("验证常用旅客信息链接"); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_menu_manage_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_Passenger")).Click(); //证书判断 SeleniumFun.CheckSecurity(driver); Thread.Sleep(MinSleepTime); //验证列表显示正常 driver.FindElement(By.Id("txt_keyword")).SendKeys("test"); driver.FindElement(By.Id("bt_Search")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr[1]/td[2]")).Text, "test/test", "列表显示正常"); //修改常用旅客信息 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr[1]/td[9]/a[1]")).Click(); Thread.Sleep(MIDSleepTime); driver.FindElement(By.Id("txt_namecn")).Clear(); driver.FindElement(By.Id("txt_namecn")).SendKeys("令狐冲"); driver.FindElement(By.Id("txt_mobile")).Clear(); driver.FindElement(By.Id("txt_mobile")).SendKeys("13888888888"); SeleniumFun.SelectByText(driver.FindElement(By.ClassName("vam")), "身份证"); driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).Clear(); driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).SendKeys("21080219900409251x"); driver.FindElement(By.Id("bt_SaveAdd")).Click(); driver.FindElement(By.Id("input_pwd_check")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.ClassName("btn_l3")).Click(); Thread.Sleep(MinSleepTime); //验证修改是否正确 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr[1]/td[9]/a[1]")).Click(); CtripAssert.AreEqual(driver, driver.FindElement(By.Id("txt_namecn")).GetAttribute("value"), "令狐冲"); CtripAssert.AreEqual(driver, driver.FindElement(By.Id("txt_mobile")).GetAttribute("value"), "13888888888"); CtripAssert.AreEqual(driver, driver.FindElement(By.ClassName("vam")).GetAttribute("value"), "1"); CtripAssert.AreEqual(driver, driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).GetAttribute("value"), "21080219900409251x", "修改成功"); //数据回滚 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/table/tbody/tr[1]/td[9]/a[1]")).Click(); Thread.Sleep(MIDSleepTime); driver.FindElement(By.Id("txt_namecn")).Clear(); driver.FindElement(By.Id("txt_mobile")).Clear(); driver.FindElement(By.Id("txt_mobile")).SendKeys("13111111111"); SeleniumFun.SelectByText(driver.FindElement(By.ClassName("vam")), "护照"); driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).Clear(); driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[1]")).SendKeys("chinesehz001"); driver.FindElement(By.XPath("//ul/li/div[3]/div[5]/div[2]/div[3]/ul/li[1]/input[2]")).SendKeys("2015-01-01"); driver.FindElement(By.Id("bt_SaveAdd")).Click(); driver.FindElement(By.Id("input_pwd_check")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.ClassName("btn_l3")).Click(); Thread.Sleep(MinSleepTime); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }
public void YongHuXinXi002() { try { Log.Info("开始执行用例"); //打开首页 baseURL = UserHT["url"].ToString(); driver.Navigate().GoToUrl(baseURL); //登录 LoginOn loginOn = new LoginOn(driver); loginOn.CNLoginOn(UserHT["测试用户登录名"].ToString(), UserHT["测试用户登陆密码"].ToString()); Thread.Sleep(MinSleepTime); //展开个人中心菜单 driver.FindElement(By.Id("menu_person_icon_id")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("ctl00_MainContentPlaceHolder_PageLeft1_MyAccount")).Click(); //证书判断 if (SeleniumFun.IsExists(driver, By.Id("overridelink"))) { driver.FindElement(By.Id("overridelink")).Click(); Thread.Sleep(3000); } Thread.Sleep(MinSleepTime); CtripAssert.Contains(driver, driver.FindElement(By.Id("info_title_id")).Text, "个人信息设置", "验证个人账户链接跳转"); //修改个人信息 driver.FindElement(By.Id("nickName")).Clear(); driver.FindElement(By.Id("nickName")).SendKeys("一统江湖"); driver.FindElement(By.Id("name")).Click(); driver.FindElement(By.Id("name")).Clear(); driver.FindElement(By.Id("name")).SendKeys("东方不败"); driver.FindElement(By.Id("radioSexWoman")).Click(); driver.FindElement(By.Id("btnSave")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("infoUpdateConfirmPwd")).Click(); driver.FindElement(By.Id("infoUpdateConfirmPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.Id("btnInfoUpdateConfirm")).Click(); Thread.Sleep(MIDSleepTime); CtripAssert.Contains(driver, driver.FindElement(By.XPath("//container/div[2]/div[2]/div[1]")).Text, "信息修改成功", "修改个人信息成功"); Thread.Sleep(MIDSleepTime); driver.FindElement(By.Id("btnInfoUpdateSuccessConfirm")).Click(); Thread.Sleep(MIDSleepTime); bool flag = driver.FindElement(By.Id("radioSexWoman")).Selected; CtripAssert.AreEqual(driver, flag.ToString(), "True", ""); CtripAssert.AreEqual(driver, driver.FindElement(By.Id("nickName")).GetAttribute("value"), "一统江湖", ""); CtripAssert.AreEqual(driver, driver.FindElement(By.Id("name")).GetAttribute("value"), "东方不败", "修改成功"); //数据回滚 driver.FindElement(By.Id("nickName")).Clear(); driver.FindElement(By.Id("nickName")).SendKeys("独步天下"); driver.FindElement(By.Id("name")).Click(); driver.FindElement(By.Id("name")).Clear(); driver.FindElement(By.Id("name")).SendKeys("令狐冲"); driver.FindElement(By.Id("radioSexMan")).Click(); driver.FindElement(By.Id("btnSave")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("infoUpdateConfirmPwd")).Click(); driver.FindElement(By.Id("infoUpdateConfirmPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.Id("btnInfoUpdateConfirm")).Click(); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("btnInfoUpdateSuccessConfirm")).Click(); Thread.Sleep(MinSleepTime); //修改个人密码 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div/h3")).Click(); driver.FindElement(By.Id("oldPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.Id("newPwd")).SendKeys("111111"); driver.FindElement(By.Id("confirmNewPwd")).SendKeys("111111"); driver.FindElement(By.Id("btnPwdSave")).Click(); Thread.Sleep(MinSleepTime); CtripAssert.Contains(driver, "密码修改成功。", driver.FindElement(By.XPath("//container/div[2]/div[2]/div[1]")).Text, "密码修改功能验证"); Thread.Sleep(MinSleepTime); driver.FindElement(By.Id("btnPwdUpdateSuccessConfirm")).Click(); Thread.Sleep(MIDSleepTime); //数据回滚 driver.FindElement(By.XPath("//ul/li/div[3]/div[2]/div/h3")).Click(); driver.FindElement(By.Id("oldPwd")).SendKeys("111111"); driver.FindElement(By.Id("newPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.Id("confirmNewPwd")).SendKeys(UserHT["测试用户登陆密码"].ToString()); driver.FindElement(By.Id("btnPwdSave")).Click(); Thread.Sleep(MIDSleepTime); driver.FindElement(By.XPath("//container/div[2]/div[2]/div[1]")).Click(); } catch (Exception e) { new CtripException(driver, e.ToString(), this.GetType().ToString(), MethodBase.GetCurrentMethod().ToString()); } }