/// <summary> /// TypeAccountingDeatls enters details in Accounting Page /// </summary> /// <param name="driver"></param> /// <param name="reporter"></param> /// <param name="costcenternumber">First Name</param> public static void TypeAccountingDeatls(RemoteWebDriver driver, Iteration reporter, string costcenternumber) { reporter.Add(new Act("Entered Cost center text")); Selenide.SwitchToFrame(driver, Locator.Get(LocatorType.ID, "iFrameSiteContents")); Selenide.SetText(driver, Util.GetLocator("CostCenter_txt"), Selenide.ControlType.Textbox, costcenternumber); }
public static void EnterSearchInput(RemoteWebDriver driver, string searchinput) { //Enter the search input: what is the size of the sun Selenide.ScrollToElement(driver, Util.GetLocator("NavigationBar")); Selenide.SetText(driver, Util.GetLocator("NavigationBar"), Selenide.ControlType.Textbox, searchinput); Selenide.Click(driver, Util.GetLocator("search_Btn")); test.Log(LogStatus.Pass, "Entered the search input text is 'what is the size of the sun'"); }
/// <summary> /// Clicks [Project Search] on top bar /// </summary> public static void QuickNavLineItem(RemoteWebDriver driver, Iteration reporter, String lineItemId) { reporter.Add(new Act("Set Quick Navigation Line Item " + lineItemId)); Selenide.SetText(driver, new Locator(LocatorType.ID, "quickNavInput"), Selenide.ControlType.Textbox, lineItemId); if (Selenide.Browser.isIPadSafari(driver)) { Selenide.JS.Enter(driver, new Locator(LocatorType.ID, "quickNavInput")); } else { Selenide.Enter(driver, new Locator(LocatorType.ID, "quickNavInput")); } }
/// <summary> /// Performs login /// </summary> /// <param name="Driver">Initialized RemoteWebDriver instance</param> /// <param name="username">Login Username</param> /// <param name="password">Login Password</param> public static void Login(RemoteWebDriver driver, Iteration reporter, string username, string password) { reporter.Add(new Act(String.Format("Set Username {0}, Password {1} and Click Login", username, password))); Selenide.WaitForElementVisible(driver, Util.GetLocator("UserNamTxtBox")); Selenide.SetText(driver, Util.GetLocator("UserNamTxtBox"), Selenide.ControlType.Textbox, username); Selenide.SetText(driver, Util.GetLocator("PasswordTxtBox"), Selenide.ControlType.Textbox, password); Selenide.Click(driver, Util.GetLocator("LoginBtn")); System.Threading.Thread.Sleep(2000); Actions actions = new Actions(driver); actions.SendKeys(OpenQA.Selenium.Keys.Escape); //var ajaxIsComplete = (bool)(driver as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0"); ((IJavaScriptExecutor)driver).ExecuteScript("return window.stop();"); var ajaxIsComplete = (bool)(driver as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0"); //Selenide.WaitForElementVisible(driver, Util.GetLocator("DashBoardOpenTickets")); }
/// <summary> /// TypeCostCenterNumber method enters cost center number in cost center number field /// </summary> /// <param name="driver"></param> /// <param name="reporter"></param> /// <param name="costCenterNumber">Store Number</param> public static void TypeCostCenterNumber(RemoteWebDriver driver, Iteration reporter, string costCenterNumber) { reporter.Add(new Act("Enter cost center number in cost center number field")); Selenide.SwitchToFrame(driver, Locator.Get(LocatorType.ID, "iFrameSiteContents")); if (costCenterNumber.Equals("")) { return; } else if (Selenide.IsElementExists(driver, Util.GetLocator("CostCenterNumber1_txt"))) { Selenide.Clear(driver, Util.GetLocator("CostCenterNumber1_txt"), Selenide.ControlType.Textbox); Selenide.SetText(driver, Util.GetLocator("CostCenterNumber1_txt"), Selenide.ControlType.Textbox, costCenterNumber); } //Selenide.SwitchToDefaultContent(driver); }
public static void LoginToWolframWithInvalidCredentials(RemoteWebDriver driver, string userName, string password) { //(new Act("Enter User name")); Selenide.WaitForElementVisible(driver, Util.GetLocator("User_EmailTextBox")); Selenide.SetText(driver, Util.GetLocator("User_EmailTextBox"), Selenide.ControlType.Textbox, userName); //(new Act("Enter Password")); Selenide.SetText(driver, Util.GetLocator("User_PasswordTextBox"), Selenide.ControlType.Textbox, password); //(new Act("clickon sig in button")); Selenide.Click(driver, Util.GetLocator("Login_SiginBtn")); //Verify successfully logged in to application Selenide.WaitForElementVisible(driver, Util.GetLocator("ErrorLogin")); Selenide.Query.isElementVisible(driver, Util.GetLocator("ErrorLogin")); test.Log(LogStatus.Pass, "Error message displayed"); }
public static void LoginToWolfram(RemoteWebDriver driver, string userName, string password) { //(new Act("Enter User name")); Selenide.SetText(driver, Util.GetLocator("User_EmailTextBox"), Selenide.ControlType.Textbox, userName); //(new Act("Enter Password")); Selenide.SetText(driver, Util.GetLocator("User_PasswordTextBox"), Selenide.ControlType.Textbox, password); //(new Act("clickon sig in button")); Selenide.Click(driver, Util.GetLocator("Login_SiginBtn")); //Verify successfully logged in to application //Verify that the user name is Present in the nav bar Selenide.WaitForElementVisible(driver, Locator.Get(LocatorType.XPath, "//span[text()='" + userName + "']")); Selenide.Query.isElementVisible(driver, Locator.Get(LocatorType.XPath, "//span[text()='" + userName + "']")); test.Log(LogStatus.Pass, "User " + userName + "Logged in successfully"); }
/// <summary> /// Performs login /// </summary> /// <param name="Driver">Initialized RemoteWebDriver instance</param> /// <param name="username">Login Username</param> /// <param name="password">Login Password</param> public static void Login(RemoteWebDriver driver, Iteration reporter, string username, string password) { try { reporter.Add(new Act(String.Format("Set Username {0}, Password {1} and Click Login", username, password))); Selenide.WaitForElementNotVisible(driver, Locator.Get(LocatorType.ID, "dlg_spinner")); Selenide.WaitForElementVisible(driver, Util.GetLocator("UserName_txt")); Selenide.SetText(driver, Util.GetLocator("UserName_txt"), Selenide.ControlType.Textbox, username); Selenide.WaitForElementVisible(driver, Util.GetLocator("Password_txt")); Selenide.SetText(driver, Util.GetLocator("Password_txt"), Selenide.ControlType.Textbox, password); Selenide.WaitForElementVisible(driver, Util.GetLocator("Login_btn")); Selenide.JS.Click(driver, Util.GetLocator("Login_btn")); Selenide.WaitForElementNotVisible(driver, Locator.Get(LocatorType.ID, "dlg_spinner")); System.Threading.Thread.Sleep(5000); } catch (Exception ex) { } }
//Click on schedule Link public static void ClickScheduleTourLink(RemoteWebDriver driver) { Selenide.Wait(driver, 3, true); test.Log(LogStatus.Pass, "Click on Schedule Tour Link"); driver.SwitchTo().Frame(2); Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//html/body/div/descendant::li/button[text()='Schedule a Tour']")); Selenide.Wait(driver, 3, true); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame(2); test.Log(LogStatus.Pass, "Select avalable Date"); Selenide.Click(driver, Locator.Get(LocatorType.ID, "date")); Selenide.Wait(driver, 3, true); Selenide.Click(driver, Locator.Get(LocatorType.XPath, "(//td[@aria-disabled='false'])[1]")); //Selenide.JS.Click(driver, Locator.Get(LocatorType.XPath, "(//td[@aria-disabled='false'])[2]")); //Select time Selenide.Wait(driver, 3, true); Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//select[@tabindex='3']"), Selenide.ControlType.Index, "0"); //Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//select/option[text()='11:00 am']")); //Enter First Name Random _random = new Random(); string uniqnum = _random.Next(0, 9999).ToString("0000"); Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='First name']"), Selenide.ControlType.Textbox, "AutoFirst" + uniqnum); test.Log(LogStatus.Pass, "Entered First Name : AutoFirst" + uniqnum); //LastName Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='Last name']"), Selenide.ControlType.Textbox, "AutoLast" + uniqnum); test.Log(LogStatus.Pass, "Enter Last Name : AutoLast" + uniqnum); //Email Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='Email']"), Selenide.ControlType.Textbox, "AutoEmail" + uniqnum + "@gmail.com"); test.Log(LogStatus.Pass, "Entered Email as : AutoEmail" + uniqnum + "@gmail.com"); //Uniq Phone Number Random rand = new Random(100); int phoneNumber = rand.Next(0000000000, 999999999); //Phone Number Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//input[@placeholder='Phone']"), Selenide.ControlType.Textbox, "9" + phoneNumber.ToString()); test.Log(LogStatus.Pass, "Entered Phone Number 9" + phoneNumber.ToString()); //Message test.Log(LogStatus.Pass, "Enter Message"); Selenide.SetText(driver, Locator.Get(LocatorType.XPath, "//textarea[@placeholder='Add your message']"), Selenide.ControlType.Textbox, "Hello This is Testing"); //Bedrooms test.Log(LogStatus.Pass, "Select Bedrooms in dropdown"); Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//select/option[text()='2 bedroom']")); //Unit test.Log(LogStatus.Pass, "Select Unit"); Selenide.Click(driver, Locator.Get(LocatorType.XPath, "//select/option[text()='$1312 - 1bd 1ba - Unit 321, Avail Today']")); //BookTour Button test.Log(LogStatus.Pass, "Click BookTour button"); Selenide.Click(driver, Util.GetLocator("BooktourBtn")); Selenide.Wait(driver, 3, true); driver.SwitchTo().DefaultContent(); Selenide.Wait(driver, 3, true); driver.SwitchTo().Frame(2); //div[@class='doorway-plugin-header doorway-themed-bg']/span Selenide.Wait(driver, 3, true); string txt = Selenide.GetText(driver, Locator.Get(LocatorType.XPath, "//div[@class='doorway-plugin-header doorway-themed-bg']//span"), Selenide.ControlType.Label); if (txt == "You're booked with Apartment Test 2") { test.Log(LogStatus.Pass, "Appointment Booked successfully"); Common.Takescreenshot(driver); } else { test.Log(LogStatus.Fail, "Appointment Not Booked successfully"); Common.Takescreenshot(driver); } }
/// <summary> /// TypeSearchText method type search key words in Search text box /// </summary> /// <param name="driver"></param> /// <param name="reporter"></param> /// <param name="searchKey">Keywords wish to search</param> public static void TypeSearchText(RemoteWebDriver driver, Iteration reporter, String searchKey) { reporter.Add(new Act(String.Format("Type '{0}' search keyword(s)/ character(s) at Search Text box", searchKey))); Selenide.SetText(driver, Util.GetLocator("search_txt"), Selenide.ControlType.Textbox, searchKey); }
public static void search(RemoteWebDriver driver, string text) { Selenide.SetText(driver, Util.GetLocator("Googlesearch"), Selenide.ControlType.Textbox, text); }