public void PrintInvoice() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebSite()); Assert.AreEqual("TCO Log In", WindowHelper.GetTitle()); TextBoxHelper.SendKeys(By.Id("txtUserName"), ObjectRepository.Config.GetUserName()); TextBoxHelper.SendKeys(By.Id("txtPassword"), ObjectRepository.Config.GetUserPassword()); ButtonHelper.ClickButton(By.Id("btnLogIn")); // check if we are in the main menu Welcom to TCO var clerk = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='tblMainMenuNL']/descendant::td[position()=1]")); Assert.AreEqual("Welcome To TCO", WindowHelper.GetTitle()); clerk.Click(); // wait until find the " File " tab And Click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='File']")).Click(); //wait for the " open exsiting file " option and click it var kk = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_TopRadMenu1']/descendant::span[text()='Open Existing File']")); kk.Click(); // Switch to frame // Note --> I found Iframe Xpath from the main form not from the small new form that appears in the main form BrowserHelper.SwitchToFrame(ObjectRepository.Driver.FindElement(By.XPath("//div[@id='cboxLoadedContent']/child::iframe "))); GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//input[@id='txtFileNo']")).SendKeys("170228");//170228 is the docket No' to open //locate the OK Button and click it GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("btnOk")).Click(); Thread.Sleep(4000); }
public static void Login() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebSite()); TextBoxHelper.SendKeys(By.Id("txtUserName"), ObjectRepository.Config.GetUserName()); TextBoxHelper.SendKeys(By.Id("txtPassword"), ObjectRepository.Config.GetUserPassword()); //Console.WriteLine("Is the Button Log In is Enabled :{0}", ButtonHelper.IsButtonEnabled(By.Id("btnLogIn"))); //Console.WriteLine("the web page title is :{0}", WindowHelper.GetTitle()); //Console.WriteLine("the button text is :{0}", ButtonHelper.GetButtonText(By.Id("btnLogIn"))); ButtonHelper.ClickButton(By.Id("btnLogIn")); }
public static void LogInNazaren() { NavigationHelper.NavigateToUrl("http://10.168.241.59/tcowebsitedemo"); TextBoxHelper.SendKeys(By.Id("txtUserName"), ObjectRepository.Config.GetNazareneUser()); TextBoxHelper.SendKeys(By.Id("txtPassword"), ObjectRepository.Config.GetNazarenPassword()); Console.WriteLine("Is the Button Log In is Enabled :{0}", ButtonHelper.IsButtonEnabled(By.Id("btnLogIn"))); Console.WriteLine("the web page title is :{0}", WindowHelper.GetTitle()); Console.WriteLine("the button text is :{0}", ButtonHelper.GetButtonText(By.Id("btnLogIn"))); ButtonHelper.ClickButton(By.Id("btnLogIn")); Thread.Sleep(3000); }
public void EnterDocketNumber() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebSite()); Assert.AreEqual("TCO Log In", WindowHelper.GetTitle()); TextBoxHelper.SendKeys(By.Id("txtUserName"), ObjectRepository.Config.GetUserName()); TextBoxHelper.SendKeys(By.Id("txtPassword"), ObjectRepository.Config.GetUserPassword()); ButtonHelper.ClickButton(By.Id("btnLogIn")); // check if we are in the main menu Welcom to TCO var ReservationCenterIcon = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='tblMainMenuNL']/descendant::td[position()=3]")); Assert.AreEqual("Welcome To TCO", WindowHelper.GetTitle()); ReservationCenterIcon.Click(); /* switch to the desired Tab " flight,hotel and services " * * * Xpath :Flight --> //div[@id='ctl00_ContentPlaceHolder1_RadTabStrip1']/descendant::li[1] * Xpath :Hotel --> //div[@id='ctl00_ContentPlaceHolder1_RadTabStrip1']/descendant::li[3] * Xpath :Services --> //div[@id='ctl00_ContentPlaceHolder1_RadTabStrip1']/descendant::li[4] * */ // wsitch to the hotel tab GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//div[@id='ctl00_ContentPlaceHolder1_RadTabStrip1']/descendant::li[3]")).Click(); // wait and locate the "Docket No" textbox GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_txtHotelDocketNo")).SendKeys("170377"); //click the "Show Reservation " Button ButtonHelper.ClickButton(By.Id("ctl00_ContentPlaceHolder1_btnShowHotelResv_input")); //select the first row and GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_grdHotels_ctl00__0")).Click(); // select the report type from the " Reports " combobox by clicking the combobox arrow GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.Id("ctl00_ContentPlaceHolder1_cmbHotelReports_Arrow")).Click(); DropDownListHelper.SelectElementByText(By.XPath("//input[@id='ctl00_ContentPlaceHolder1_cmbHotelReports_Input']"), "Hotel Confirmation"); Thread.Sleep(5000); }
public void Dropdown() { NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebSite()); Assert.AreEqual("TCO Log In", WindowHelper.GetTitle()); TextBoxHelper.SendKeys(By.Id("txtUserName"), ObjectRepository.Config.GetUserName()); TextBoxHelper.SendKeys(By.Id("txtPassword"), ObjectRepository.Config.GetUserPassword()); ButtonHelper.ClickButton(By.Id("btnLogIn")); // check if we are in the main menu Welcom to TCO var ReservationCenterIcon = GenericHelper.WaitForElementAndGetIt(ObjectRepository.Driver, By.XPath("//table[@id='tblMainMenuNL']/descendant::td[position()=3]")); Assert.AreEqual("Welcome To TCO", WindowHelper.GetTitle()); ReservationCenterIcon.Click(); //select the dropdown DropDownListHelper.SelectElementByIndex(By.Id("ctl00_ContentPlaceHolder1_cmbHotelReports_Input"), 0); //Display the Tests results System.Console.WriteLine("The test name IS.{0} .and the Test result is :{1}", TestContext.TestName, TestContext.CurrentTestOutcome); Thread.Sleep(2000); }