コード例 #1
0
        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());
            }
        }
コード例 #2
0
 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());
     }
 }
コード例 #3
0
        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());
            }
        }
コード例 #4
0
        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());
            }
        }
コード例 #5
0
 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());
     }
 }