private void Search(int row) { string valueToSearch = handle.GetNext(row, col); if (valueToSearch != null) { string textboxName = "ctl00$ctl00$ctl00$BodyContent$ContentPlaceHolder1$MainContentPlaceHolder$ResourceHostControl1$resContainer$rptContainers$ctl00$rptColumn1$ctl00$ctl01$Wrapper$txtSearchString"; string attributeDropdown = "ctl00$ctl00$ctl00$BodyContent$ContentPlaceHolder1$MainContentPlaceHolder$ResourceHostControl1$resContainer$rptContainers$ctl00$rptColumn1$ctl00$ctl01$Wrapper$lbxNodeProperty"; string searchBtnId = "ctl00_ctl00_ctl00_BodyContent_ContentPlaceHolder1_MainContentPlaceHolder_ResourceHostControl1_resContainer_rptContainers_ctl00_rptColumn1_ctl00_ctl01_Wrapper_btnSearch"; chrome.Navigate().GoToUrl("https://solarwindscs.dell.com/Orion/SummaryView.aspx?ViewID=1"); while (IsElementPresent(textboxName, false, true) == false) { Thread.Sleep(25); } try { OpenQA.Selenium.IWebElement searchBox = chrome.FindElementByName(textboxName); OpenQA.Selenium.IWebElement dropBox = chrome.FindElementByName(attributeDropdown); OpenQA.Selenium.IWebElement searchBtn = chrome.FindElementById(searchBtnId); OpenQA.Selenium.Support.UI.SelectElement select = new OpenQA.Selenium.Support.UI.SelectElement(dropBox); //Console.WriteLine("HHHHHHH"); searchBox.SendKeys(valueToSearch); //Console.WriteLine("HHHHHHH"); select.SelectByIndex(attributeIndex); // Console.WriteLine("uyguygufuov"); searchBtn.Click(); // Console.WriteLine("HHHHHHH"); while (IsElementPresent("StatusMessage", true, false) == false) { Thread.Sleep(25); } string result = chrome.FindElementByClassName("StatusMessage").Text; if (result.Contains("Nodes with ") && result.Contains(" similar to ")) { ReadOnlyCollection <OpenQA.Selenium.IWebElement> amount = chrome.FindElementsByClassName("StatusIcon"); //Console.WriteLine(amount.Count); handle.AddResult(row, valueToSearch, "Y", (amount.Count - 1).ToString()); } else { handle.AddResult(row, valueToSearch, "N", "0"); } } catch (Exception e) { throw new WebSearchException(Thread.CurrentThread.ManagedThreadId.ToString()); } } }
public void Input(UI.UIInputAction action) { try { action.Status = TestResultType.Fail; OpenQA.Selenium.IWebElement element = SeleniumUIHelper.GetElement(this.Driver, SeleniumUIHelper.GetBy(action.Element)); element.Clear(); element.SendKeys(action.Value); action.Status = TestResultType.Success; } catch (System.Exception) { action.Status = TestResultType.Fail; string fileName = string.Format("{0}_{1}_{2}.png", action.TestCaseAction.TestCase.TestCaseRef.Key, action.TestCaseAction.ActionRef.Action, System.DateTime.Now.ToString("yyyyMMddHHmmssms")); SeleniumScreenshotHelper.CreateScreenshot(this.Driver, this.TestRunner.Environment, fileName); action.Error = new ValidationException("Common.ElementCanNotFound", action.Element, fileName); } }
public void GivenAnEventExists(Table events) { foreach (var e in events.Rows) { e["Name"] += uniqueStamp; BBCRMHomePage.OpenEventsFA(); //spawn form Panel.WaitClick("//table[contains(@class,'x-btn bbui-pages-section-collapsesection x-btn-icon')]/tbody/tr[2]/td[2]/em/button"); Panel.WaitClick("//button[./text()='Add new' and contains(@class,'x-btn-text bbui-valuestyles-new-imageandtext')]"); Panel.WaitClick("//span[./text()='Event']"); //set form vars and save Dialog.SetTextField("//input[contains(@id,'_NAME_value')]", e["Name"]); OpenQA.Selenium.IWebElement _web = Dialog.GetEnabledElement("//input[contains(@id,'_STARTDATE_value')]"); _web.SendKeys(e["Start date"]); Dialog.Save(); } }
public void preparePostToFB(string postText, string pathToPhoto) { if (!(pathToPhoto is null)) { SetImageElement(); elemAddImage.SendKeys(pathToPhoto); if (isGroup) { //This line is because in group posts, I need to wait until the post button is enabled before going to publishPost() //or the photo would be lost. OpenQA.Selenium.IWebElement elemPostButton = driver.FindElement(OpenQA.Selenium.By.XPath("//button [@data-testid='react-composer-post-button']"), 60, true); } } if (!postText.Equals(string.Empty)) { SetPostTextElement(); elemPostText.SendKeys(postText); } }
public void WhenIAddEvents(Table eventsToAdd) { BBCRMHomePage.OpenEventsFA(); foreach (var eventToAdd in eventsToAdd.Rows) { eventToAdd["Name"] += uniqueStamp; BBCRMHomePage.OpenEventsFA(); //spawn form Panel.WaitClick("//table[contains(@class,'x-btn bbui-pages-section-collapsesection x-btn-icon')]/tbody/tr[2]/td[2]/em/button"); Panel.WaitClick("//button[./text()='Add new' and contains(@class,'x-btn-text bbui-valuestyles-new-imageandtext')]"); Panel.WaitClick("//span[./text()='Event']"); //set form vars and save Dialog.SetTextField("//input[contains(@id,'_NAME_value')]", eventToAdd["Name"]); OpenQA.Selenium.IWebElement _web = Dialog.GetEnabledElement("//input[contains(@id,'_STARTDATE_value')]"); _web.SendKeys(eventToAdd["Start date"]); if (eventToAdd["Location"] != null && !string.IsNullOrEmpty(eventToAdd["Location"].ToString())) { Dialog.SetTextField("//input[contains(@id,'_EVENTLOCATIONID_value')]", eventToAdd["Location"]); } Dialog.Save(); } }
public void Login(string username, string password) { SetUsername(username); SetPassword(password); elemPassword.SendKeys(OpenQA.Selenium.Keys.Enter); }
private void SetPassword(string password) { elemPassword = driver.FindElement(OpenQA.Selenium.By.Id("pass")); elemPassword.SendKeys(password); }
private void SetUsername(string username) { elemUsername = driver.FindElement(OpenQA.Selenium.By.Id("email")); elemUsername.SendKeys(username); }