/// <summary> /// Finds and waits for an element that meets specified conditions at specified time. /// </summary> /// <param name="element">The element.</param> /// <param name="locator">The locator.</param> /// <param name="timeout">The timeout.</param> /// <param name="condition">The condition to be met.</param> /// <param name="customMessage">Custom message to be displayed when there is no possible to get element</param> /// <returns> /// Return found element /// </returns> /// <example>How to use it: <code> /// this.Driver.GetElement(this.loginButton, timeout, e => e.Displayed); /// </code></example> public static IWebElement GetElement(this ISearchContext element, ElementLocator locator, double timeout, Func <IWebElement, bool> condition, [Optional] string customMessage) { var driver = element.ToDriver(); if (DriversCustomSettings.IsDriverSynchronizationWithAngular(driver)) { driver.WaitForAngular(); } var by = locator.ToBy(); var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout)) { Message = customMessage }; wait.IgnoreExceptionTypes(typeof(StaleElementReferenceException)); wait.Until( drv => { var ele = element.FindElement(@by); return(condition(ele)); }); return(element.FindElement(@by)); }
/// <summary> /// Finds and waits for an element that is visible and displayed at specified time. /// </summary> /// <typeparam name="T">IWebComponent like ICheckbox, ISelect, etc.</typeparam> /// <param name="searchContext">The search context.</param> /// <param name="locator">The locator.</param> /// <param name="timeout">Specified time to wait.</param> /// <returns> /// Located and displayed element /// </returns> /// <example>How to specify element type to get additional actions for it: <code> /// var checkbox = this.Driver.GetElement<Checkbox>(this.stackOverFlowCheckbox, timeout); /// checkbox.TickCheckbox(); /// </code></example> public static T GetElement <T>(this ISearchContext searchContext, ElementLocator locator, double timeout) where T : class, IWebElement { IWebElement webElemement = searchContext.GetElement(locator, timeout); return(webElemement.As <T>()); }
/// <summary> /// This method will return value of given atttribute /// </summary> /// <param name="pageName"></param> /// <param name="locatorName"></param> /// <param name="attributeValue"></param> /// <param name="values"></param> /// <returns></returns> public static string GetAttributeValue(string pageName, string locatorName, String attributeValue, params String[] values) { string text = "false"; By element = null; if (values.Length == 0) { element = ElementLocator.GetLocator(pageName, locatorName); } else { element = ElementLocator.GetLocator(pageName, locatorName, values); } if (element != null) { try { wait.Until(WaitHelper.ExpectedConditions.PresenceOfAllElementsLocatedBy(element)); text = driver.FindElement(element).GetAttribute(attributeValue); Report.Pass(locatorName + "Attribute " + attributeValue + " value is: " + text); log.Info(locatorName + "Attribute " + attributeValue + " value is: " + text); } catch (WebDriverException wd) { Report.Fail("Exception on the element " + locatorName + " " + wd.Message); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } } else { Report.Fail(locatorName + " not found "); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } return(text); }
/// <summary> /// This method moves the control to an element /// </summary> /// <param name="pageName"></param> /// <param name="locatorName"></param> /// <param name="values"></param> public static void MoveToElement(string pageName, string locatorName, params String[] values) { By element = null; if (values.Length == 0) { element = ElementLocator.GetLocator(pageName, locatorName); } else { element = ElementLocator.GetLocator(pageName, locatorName, values); } if (element != null) { try { wait.Until(WaitHelper.ExpectedConditions.PresenceOfAllElementsLocatedBy(element)); Actions actions = new Actions(driver); actions.MoveToElement(driver.FindElement(element)).Click().Build().Perform(); Report.Pass(locatorName + " is in Focus"); log.Info(locatorName + " is in Focus"); } catch (WebDriverException wd) { Report.Fail("Exception on the element " + locatorName + " " + wd.Message); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } } else { Report.Fail((locatorName + " not found")); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } }
/// <summary> /// This method clear the text from a control /// </summary> /// <param name="pageName"></param> /// <param name="locatorName"></param> /// <param name="values"></param> public static void ClearText(string pageName, string locatorName, params String[] values) { By element = null; if (values.Length == 0) { element = ElementLocator.GetLocator(pageName, locatorName); } else { element = ElementLocator.GetLocator(pageName, locatorName, values); } if (element != null) { try { wait.Until(WaitHelper.ExpectedConditions.PresenceOfAllElementsLocatedBy(element)); JavaScriptKeywords.HighlightElement(driver.FindElement(element)); driver.FindElement(element).Clear(); Report.Pass(locatorName + "Cleared"); log.Info(locatorName + "Cleared"); } catch (WebDriverException wd) { Report.Fail("Exception on the element " + locatorName + " " + wd.Message); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } } else { Report.Fail(locatorName + " not found"); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } }
/// <summary> /// This method click on a control /// </summary> /// <param name="pageName"></param> /// <param name="locatorName"></param> /// <param name="values"></param> public static void Click(string pageName, string locatorName, params string[] values) { By element = null; if (values.Length == 0) { element = ElementLocator.GetLocator(pageName, locatorName); } else { element = ElementLocator.GetLocator(pageName, locatorName, values); } if (element != null) { //try //{ wait.Until(WaitHelper.ExpectedConditions.ElementToBeClickable(element)); JavaScriptKeywords.HighlightElement(driver.FindElement(element)); driver.FindElement(element).Click(); Report.Pass("Clicked On " + locatorName); log.Info("Clicked On " + locatorName); //}catch(WebDriverException wd) //{ // Report.Fail("Exception on the element "+ locatorName+" "+wd.Message); // log.Error(TestContext.CurrentContext.Test.MethodName + " Exception " + wd.Message); //} } else { Report.Fail(locatorName + " not found"); log.Error(TestContext.CurrentContext.Test.MethodName + " " + locatorName + " not found"); } }
/// <summary> /// Finds and waits for an element that meets specified conditions at specified time. /// </summary> /// <typeparam name="T">IWebComponent like ICheckbox, ISelect, etc.</typeparam> /// <param name="searchContext">The search context.</param> /// <param name="locator">The locator.</param> /// <param name="timeout">Specified time to wait.</param> /// <param name="condition">The condition to be met.</param> /// <param name="customMessage">Custom message to be displayed when there is no possible to get element</param> /// <returns> /// Located and displayed element /// </returns> /// <example>How to specify element type to get additional actions for it and specify time and condition to find this element: <code> /// var checkbox = this.Driver.GetElement<Checkbox>(this.stackOverFlowCheckbox, timeout, e => e.Displayed); /// checkbox.TickCheckbox(); /// </code></example> public static T GetElement <T>(this ISearchContext searchContext, ElementLocator locator, double timeout, Func <IWebElement, bool> condition, [Optional] string customMessage) where T : class, IWebElement { IWebElement webElemement = searchContext.GetElement(locator, timeout, condition, customMessage); return(webElemement.As <T>()); }
/// <summary> /// Finds and waits for an element that is visible and displayed for long timeout. /// </summary> /// <typeparam name="T">IWebComponent like ICheckbox, ISelect, etc.</typeparam> /// <param name="searchContext">The search context.</param> /// <param name="locator">The locator.</param> /// <param name="customMessage">Custom message to be displayed when there is no possible to get element</param> /// <returns> /// Located and displayed element /// </returns> /// <example>How to specify element type to get additional actions for it: <code> /// var checkbox = this.Driver.GetElement<Checkbox>(this.stackOverFlowCheckbox); /// checkbox.TickCheckbox(); /// </code></example> public static T GetElement <T>(this ISearchContext searchContext, ElementLocator locator, [Optional] string customMessage) where T : class, IWebElement { IWebElement webElemement = searchContext.GetElement(locator, customMessage); return(webElemement.As <T>()); }
public static void WaitUntilElementIsNoLongerFound(this IWebDriver driver, ElementLocator locator, double timeout) { var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout)); wait.IgnoreExceptionTypes(typeof(StaleElementReferenceException), typeof(NoSuchElementException)); wait.Until(x => x.GetElements(locator).Count == 0); }
public void ShouldNotCrashIfElementNotAvailable() { var elStatusPage = Browser.Open <ElementStatusPage>(); var unrealElement = WebElement.Create(null, ElementLocator.Create(By.Id, "doesNotExist")); Assert.IsFalse(unrealElement.IsAvailable); }
public Test001CalculatorPage(Browser browser) : base(browser, "Calculator") { this.TxtOperand1 = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "operand1")); this.TxtOperand2 = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "operand2")); this.BtnAdd = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "add")); this.TxtResult = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "result")); }
private void VerifyElementLocator(ElementLocator objectReference) { string str = objectReference.ToString(); var docKeyRoundTrip = ElementLocator.Parse(str); Assert.AreEqual(objectReference, docKeyRoundTrip); Assert.AreEqual(str, docKeyRoundTrip.ToString()); }
private void SelectLocatorButton_Click(object sender, RoutedEventArgs e) { //Copy the selected locator to the action Locator we edit ElementLocator EL = (ElementLocator)mLocators.CurrentItem; mAction.LocateBy = EL.LocateBy; mAction.LocateValue = EL.LocateValue; }
protected void InvokeHeaderMenu(string name) { ElementLocator headerMenu = new ElementLocator(Locator.ClassName, "actions"); IWebElement menuSelection = Driver.GetElements(headerMenu).Single((x) => x.Text == name); menuSelection.Click(); Driver.WaitForAjax(); }
public Cell(IWebElement webElement, ElementLocator locator) : base(webElement.ToDriver() as RemoteWebDriver, null) { this.webElement = webElement; var id = webElement.GetAttribute("id"); this.cellView = string.Format(CultureInfo.InvariantCulture, "$('#{0}').data('kendoTreeView')", id); }
public static void WaitForElementVisibility(IWebDriver driver, ElementLocator locator) { ISearchContext element; var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(BaseConfiguration.ShortTimeout)); wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(locator.ToBy())); }
/// <summary> /// Method to verify Reward section /// </summary> /// <param name="strStatus"> return string status</param> /// <returns>True if Reward section verified successfully, else throws exception</returns> public bool VerifyMyRewardSection(string rewardName, string fromDate, string toDate, string rewardStatus, out string strStatus) { try { if (Driver.IsElementPresent(Section_MyRewards_Total, .5)) { SelectElement_AndSelectByText(Select_RewardStatus, rewardStatus); SelectElement_AndSelectByText(Select_RewardName, rewardName); Driver.GetElement(Textbox_RewardFromDate).SendText(fromDate); Driver.GetElement(Textbox_RewardToDate).SendText(toDate); Click_OnButton(Button_MyRewards_Search); ElementLocator PageCount = new ElementLocator(Locator.XPath, "//div[@class='section_content']//div[@class='pager'][1]//span[1]//a[@class='btn btn-sm'][contains(text(),'Next')]//preceding::a[1]"); ElementLocator Page = new ElementLocator(Locator.XPath, "//a[contains(text(),'2')]"); if (Driver.IsElementPresent(Page, .5)) { var NumberOfPages = Driver.GetElement(PageCount).Text; int TotalPages = Convert.ToInt32(NumberOfPages); for (var i = 1; i <= TotalPages; i++) { if (i > 1) { Driver.FindElement(By.XPath("//a[contains(text(),'" + i + "')]")).ClickElement(); string RewardName = "//span[contains(text(),'" + rewardName + "')]"; if (Driver.IsElementPresent(By.XPath(RewardName)) && Driver.IsElementPresent(Section_MyRewards_DateAwarded, .5) && Driver.IsElementPresent(Section_MyRewards_Expiration, .5) && Driver.IsElementPresent(Section_MyRewards_OrderStatus, .5)) { Driver.ScrollIntoMiddle(Section_MyRewards_DateAwarded); strStatus = "Successfully verified My Reward section and Reward Name; Reward details are:" + rewardName; return(true); } } } } else { string RewardName = "//span[contains(text(),'" + rewardName + "')]"; if (Driver.IsElementPresent(By.XPath(RewardName)) && Driver.IsElementPresent(Section_MyRewards_DateAwarded, .5) && Driver.IsElementPresent(Section_MyRewards_Expiration, .5) && Driver.IsElementPresent(Section_MyRewards_OrderStatus, .5)) { Driver.ScrollIntoMiddle(Section_MyRewards_DateAwarded); strStatus = "Successfully verified My Reward section and Reward Name; Reward details are:" + rewardName; return(true); } else { throw new Exception("Failed to verify My Reward section with RewardName Name" + rewardName); } } } } catch (Exception) { throw new Exception("Failed to verify My Reward sections"); } throw new Exception("Failed to verify My Reward sections"); }
public void LocateElementWithId() { var x = Element.Create("span", "x"); var locator = ElementLocator.FromElement(x); Assert.Equal(x.Id, locator.StartingId); Assert.NotNull(locator.Steps); Assert.Empty(locator.Steps); }
public void ShouldThrowExceptionWhenTestingEnabledAndElementNotPresent() { var elStatusPage = Browser.Open <ElementStatusPage>(); var unrealElement = WebElement.Create(null, ElementLocator.Create(By.Id, "doesNotExist")); Action checkDisplayed = () => { var displayed = unrealElement.IsEnabled; }; checkDisplayed.Should().Throw <ElementNotFoundException>(); }
/// <summary> /// Finds elements that meet specified conditions. /// </summary> /// <typeparam name="T">IWebComponent like Checkbox, Select, etc.</typeparam> /// <param name="searchContext">The search context.</param> /// <param name="locator">The locator.</param> /// <param name="condition">The condition to be met.</param> /// <returns> /// Located elements /// </returns> /// <example>How to find displayed elements and specify element type to get additional actions for them : <code> /// var checkboxes = this.Driver.GetElements<Checkbox>(this.stackOverFlowCheckbox, e => e.Displayed); /// checkboxes[0].TickCheckbox(); /// </code></example> public static IList <T> GetElements <T>(this ISearchContext searchContext, ElementLocator locator, Func <IWebElement, bool> condition) where T : class, IWebElement { var webElements = searchContext.GetElements(locator, condition); return (new ReadOnlyCollection <T>( webElements.Select(e => e.As <T>()).ToList())); }
public void TestElementLocatorQuote() { Assert.AreEqual("a", ElementLocator.QuoteIfSpecial("a")); Assert.AreEqual("\"/\"", ElementLocator.QuoteIfSpecial("/")); Assert.AreEqual("\"?\"", ElementLocator.QuoteIfSpecial("?")); Assert.AreEqual("\"&\"", ElementLocator.QuoteIfSpecial("&")); Assert.AreEqual("\"=\"", ElementLocator.QuoteIfSpecial("=")); Assert.AreEqual("\"\"\"\"", ElementLocator.QuoteIfSpecial("\"")); }
public void Navigator_Users_SelectOrganizationEnvironment(string envName, string orderid, out string output) { if (Driver.IsElementPresent(HomeIconOnUsersHomepage, .4) || (Driver.IsElementPresent(Button_SwitchEnv, 1))) { string orgName = Orgnization_value; ElementLocator SelectOrgEnvOnUsersHomepage = new ElementLocator(Locator.XPath, "//h3[contains(text(),'" + orgName + "')]//following-sibling::span[position()=" + orderid + "]//a[contains(text(),'" + envName + "')]"); { Driver.GetElement(SelectOrgEnvOnUsersHomepage).ClickElement(); } } output = "Selected Environment :" + envName + " Successfully"; }
/// <summary> /// Finds and waits for LongTimeout timeout for at least minimum number of elements that are enabled and displayed. /// </summary> /// <param name="element">The element.</param> /// <param name="locator">The locator.</param> /// <param name="minNumberOfElements">The minimum number of elements to get</param> /// <returns> /// Return all found and displayed and enabled elements /// </returns> /// <example>How to find elements : <code> /// var checkboxes = this.Driver.GetElements(this.stackOverFlowCheckbox, 1); /// </code></example> public static IList <IWebElement> GetElements(this ISearchContext element, ElementLocator locator, int minNumberOfElements) { IList <IWebElement> elements = null; WaitHelper.Wait( () => (elements = GetElements(element, locator, e => e.Displayed && e.Enabled).ToList()).Count >= minNumberOfElements, TimeSpan.FromSeconds(BaseConfiguration.LongTimeout), "Timeout while getting elements"); return(elements); }
/// <summary> /// Finds and waits for given timeout for at least minimum number of elements that meet specified conditions. /// </summary> /// <param name="element">The element.</param> /// <param name="locator">The locator.</param> /// <param name="timeout">Specified time to wait.</param> /// <param name="condition">Condition to be fulfilled by elements</param> /// <param name="minNumberOfElements">The minimum number of elements to get</param> /// <returns> /// Return all found and displayed and enabled elements /// </returns> /// <example>How to find elements : <code> /// var checkboxes = this.Driver.GetElements(this.stackOverFlowCheckbox, timeout, e => e.Displayed && e.Enabled, 1); /// </code></example> public static IList <IWebElement> GetElements(this ISearchContext element, ElementLocator locator, double timeout, Func <IWebElement, bool> condition, int minNumberOfElements) { IList <IWebElement> elements = null; WaitHelper.Wait( () => (elements = GetElements(element, locator, condition).ToList()).Count >= minNumberOfElements, TimeSpan.FromSeconds(timeout), "Timeout while getting elements"); return(elements); }
public Test000LoginPage(Browser browser) : base(browser, "Virtual Store - Login") { this.TxtUserName = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "userName")); this.TxtPassword = WebElement.Create(this.Browser, this, ElementLocator.Create(By.Id, "password")); this.BtnLogin = WebElement.CreateNavigation <Test000HomePage>(this.Browser, this, ElementLocator.Create(By.Id, "login")); this.DdlCountry = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "country")); this.DdlCity = WebElement.CreateSelect(this.Browser, this, ElementLocator.Create(By.Id, "city")); this.CtlMenu = WebElement.CreateControl <MenuListItemControl>(this.Browser, this, ElementLocator.Create(By.Id, "menu")); }
private void AddActionButton_Click(object sender, RoutedEventArgs e) { if (mActions.CurrentItem == null) { Reporter.ToUser(eUserMsgKeys.AskToSelectAction); return; } Act act = (Act)((Act)(mActions.CurrentItem)).CreateCopy(); act.Active = true; act.AddNewReturnParams = true; ElementLocator EL = (ElementLocator)mLocators.CurrentItem; if ((mActions.CurrentItem).GetType() == typeof(ActUIElement)) { ActUIElement aaa = (ActUIElement)mActions.CurrentItem; ActUIElement actUI = (ActUIElement)act; actUI.ElementLocateBy = EL.LocateBy; actUI.ElementLocateValue = EL.LocateValue; actUI.Value = ValueTextBox.Text; actUI.GetOrCreateInputParam(ActUIElement.Fields.ControlActionValue, ValueTextBox.Text); actUI.GetOrCreateInputParam(ActUIElement.Fields.ElementType, aaa.GetInputParamValue(ActUIElement.Fields.ElementType)); actUI.GetOrCreateInputParam(ActUIElement.Fields.ControlAction, aaa.GetInputParamValue(ActUIElement.Fields.ControlAction)); actUI.GetOrCreateInputParam(ActUIElement.Fields.ElementAction, aaa.GetInputParamValue(ActUIElement.Fields.ElementAction)); actUI.GetOrCreateInputParam(ActUIElement.Fields.WhereColSelector, aaa.GetInputParamValue(ActUIElement.Fields.WhereColSelector)); actUI.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnTitle, aaa.GetInputParamValue(ActUIElement.Fields.WhereColumnTitle)); actUI.GetOrCreateInputParam(ActUIElement.Fields.WhereColumnValue, aaa.GetInputParamValue(ActUIElement.Fields.WhereColumnValue)); actUI.GetOrCreateInputParam(ActUIElement.Fields.WhereOperator, aaa.GetInputParamValue(ActUIElement.Fields.WhereOperator)); actUI.GetOrCreateInputParam(ActUIElement.Fields.WhereProperty, aaa.GetInputParamValue(ActUIElement.Fields.WhereProperty)); act = actUI; } else { act.LocateBy = EL.LocateBy; act.LocateValue = EL.LocateValue; act.Value = ValueTextBox.Text; } App.BusinessFlow.AddAct(act); int selectedActIndex = -1; ObservableList <Act> actsList = App.BusinessFlow.CurrentActivity.Acts; if (actsList.CurrentItem != null) { selectedActIndex = actsList.IndexOf((Act)actsList.CurrentItem); } if (selectedActIndex >= 0) { actsList.Move(actsList.Count - 1, selectedActIndex + 1); } ActionEditPage AEP = new ActionEditPage(act); AEP.ShowAsWindow(); }
/// <summary> ///Search Based On TransactionNumber /// </summary> /// <param name="TransactionNumber"></param> /// <returns>Message with Status (Boolean)</returns> public bool Select_TransactionFromTable(string TransactionNumber, out string Message) { try { string Table = "//td[@colspan='6']//table//td//a"; ElementLocator Web_ResultTable = new ElementLocator(Locator.XPath, Table); bool Avaiod_doublclick = false; if (Driver.IsElementPresent(Web_ResultTable, 1)) { List <IWebElement> TableValues = new List <IWebElement>(Driver.FindElements(By.XPath(Table))); int TableCount = TableValues.Count(); int firstimevalue = 2; Driver.FindElement(By.XPath(Table)).ScrollToElement(); for (int RowValue = 0; RowValue <= TableCount; RowValue++) { Driver.FindElement(By.XPath(Table)).ScrollToElement(); TableValues = new List <IWebElement>(Driver.FindElements(By.XPath(Table))); Avaiod_doublclick = false; ElementLocator TransactionWithSelectOption = new ElementLocator(Locator.XPath, TransactionSelect(TransactionNumber)); if (Driver.IsElementPresent(TransactionWithSelectOption, 1)) { Driver.GetElement(TransactionWithSelectOption).ClickElement(); return(VerifyTransactionSuccessMessage(TransactionNumber, out Message)); } if (TableValues[RowValue].GetTextContent().Contains("...")) { int currentpagevalue = int.Parse(TableValues[RowValue - 1].GetTextContent()); Driver.FindElement(By.XPath("//td[@colspan]//table//td//a[text()='...']")).ClickElement(); List <IWebElement> TableValues1 = new List <IWebElement>(Driver.FindElements(By.XPath(Table))); RowValue = 3; TableCount = TableValues1.Count; Avaiod_doublclick = true; firstimevalue = firstimevalue + 1; } if (Avaiod_doublclick == false) { Driver.FindElement(By.XPath("//td[@colspan]//table//td//a[text()='" + firstimevalue + "']")).ClickElement(); firstimevalue++; } } } else { return(VerifyTransactionSuccessMessage(TransactionNumber, out Message)); } throw new Exception("Failed to SearchTransaction Number" + TransactionNumber); } catch (Exception e) { throw new Exception("Failed to SearchTransaction Number" + TransactionNumber); } }
public IEnumerable <IWebElement> FindElements(string locator) { if (string.IsNullOrWhiteSpace(locator)) { throw new ArgumentNullException("locator"); } var by = ElementLocator.Parse(locator); return(this.Driver.FindElements(by)); }
public ElementLocator RulesWithAllVariables_WithoutConfigure(Rules Rule) { if (Rule.Rulestatus_ToInactive) { ElementLocator _Menu1 = new ElementLocator(Locator.XPath, "//span[contains(text(),'" + Rule.RuleName + "') and contains(@id,'RuleName')]//..//..//td//span[contains(text(),'" + Rule.RuleOwner + "')]//..//..//td//span[contains(text(),'" + Rule.RuleType + "')]//..//..//td//span[contains(text(),'" + Rule.Invocation + "')]//..//..//td//span[text()='" + Rule.Sequence + "']//..//..//td//span//input[contains(@id,'Active')and not(@checked='checked')]"); return(_Menu1); } ElementLocator _Menu = new ElementLocator(Locator.XPath, "//span[contains(text(),'" + Rule.RuleName + "') and contains(@id,'RuleName')]//..//..//td//span[contains(text(),'" + Rule.RuleOwner + "')]//..//..//td//span[contains(text(),'" + Rule.RuleType + "')]//..//..//td//span[contains(text(),'" + Rule.Invocation + "')]//..//..//td//span[text()='" + Rule.Sequence + "']//..//..//td//span//input[contains(@id,'Active')and @checked='checked']"); return(_Menu); }
public void SelectTextInCaseTextIsAvailable(ElementLocator Elem, string PromotionValue) { try { if (!string.IsNullOrEmpty(PromotionValue)) { SelectElement_AndSelectByText(Elem, PromotionValue); } } catch (Exception e) { throw new Exception("Failed to Select Promotion:" + PromotionValue); } }