/// <summary> /// Mapeamento referente ao campo "Logar" /// </summary> /// <returns></returns> public ILink campoLogin() { return(browser.Describe <ILink>(new LinkDescription { InnerText = @"Acesse sua conta ou cadastre-se ", TagName = @"A" })); }
public void WhenIFilterByColor(string strSelectColor) { model.AdvantageShoppingPage.COLORLink.Click(); System.Threading.Thread.Sleep(1000); String strHexColor = null; switch (strSelectColor.ToLower()) { case "white": strHexColor = "FFFFFF"; break; case "black": strHexColor = "414141"; break; case "blue": strHexColor = "3683D1"; break; case "gray": strHexColor = "C3C3C3"; break; case "purple": strHexColor = "545195"; break; case "red": strHexColor = "DD3A5B"; break; case "yellow": strHexColor = "FCC23D"; break; } var mICEShopNowLink = browser.Describe <ILink>(new LinkDescription { CSSSelector = @"div#micesImg", XPath = @"//DIV[@id=""micesImg""]" }); IWebElement colorPicker = browser.Describe <IWebElement>(new WebElementDescription { AccessibilityName = string.Empty, ClassName = @"productColor ", Id = @"productsColors" + strHexColor, Index = 3, InnerText = string.Empty, TagName = @"A" }); colorPicker.Highlight(); colorPicker.Click(); }
/// <summary> /// Mapeamento referente ao menu principal "Comercial". /// </summary> public IWebElement MenuComercial() { return(browser.Describe <IFrame>(new FrameDescription { Name = @"menu" }) .Describe <IWebElement>(new WebElementDescription { InnerText = @"Comercial", TagName = @"A", XPath = @"//DIV[@id=""menuSistema""]/H1[11]/A[1]" })); }
public void WhenIAddAnItemToTheBasket() { var sEditField = browser.Describe <IEditField>(new EditFieldDescription { AccessibilityName = string.Empty, Name = @"s", Placeholder = @"Search products…", TagName = @"INPUT", Type = @"search", Index = 0 }); sEditField.SetValue("cap"); var searchButton = browser.Describe <IButton>(new ButtonDescription { AccessibilityName = string.Empty, ButtonType = @"submit", Name = @"Search", Role = string.Empty, TagName = @"BUTTON", Index = 0 }); searchButton.Click(); var addToCartButton = browser.Describe <IButton>(new ButtonDescription { ButtonType = @"submit", Name = @"Add to cart", TagName = @"BUTTON" }); addToCartButton.Click(); Reporter.ReportEvent("Screenshot", "example screenshot", HP.LFT.Report.Status.Passed, browser.GetSnapshot()); var homeLink = browser.Describe <ILink>(new LinkDescription { AccessibilityName = string.Empty, InnerText = @"Home", Role = string.Empty, TagName = @"A", Index = 0 }); homeLink.Click(); var cartLink = browser.Describe <ILink>(new LinkDescription { AccessibilityName = string.Empty, InnerText = @"Cart", Role = string.Empty, TagName = @"A", Index = 0 }); cartLink.Click(); }
public static ILink GetLink(IBrowser br, string linktext) { return(br.Describe <ILink>(new LinkDescription { InnerText = linktext })); }
public static bool IsItemSelected(IBrowser browser, string pattern, uint timeout) { return browser.Describe<IWebElement>(new WebElementDescription { XPath = "//span[contains(@class,'checkbox_checked_yes')]", InnerText = pattern }).Exists(timeout); }
/// <summary> /// mapeamento do botao do menu /// </summary> public IWebElement BotaoMenu(IBrowser browser) { return(browser.Describe <IImage>(new ImageDescription { TagName = @"IMG", XPath = @"//DIV[@id=""mostraMenu""]/IMG[1]" })); }
public static bool IsItemSelected(IBrowser browser, string pattern, uint timeout) { return(browser.Describe <IWebElement>(new WebElementDescription { XPath = "//span[contains(@class,'checkbox_checked_yes')]", InnerText = pattern }).Exists(timeout)); }
/// <summary> /// Mapeamento referente ao botão Entrar /// </summary> public IButton EntrarButton(IBrowser browser) { return(browser.Describe <IButton>(new ButtonDescription { ButtonType = @"submit", Name = @"Entrar", TagName = @"INPUT" })); }
/// <summary> /// Mapeamento referente ao campo de Login /// </summary> public IEditField CampoLogin(IBrowser browser) { return(browser.Describe <IEditField>(new EditFieldDescription { Name = @"Login", TagName = @"INPUT", Type = @"text" })); }
/// <summary> /// Mapeamento referente ao campo Senha /// </summary> public IEditField CampoSenha(IBrowser browser) { return(browser.Describe <IEditField>(new EditFieldDescription { Name = @"Senha", TagName = @"INPUT", Type = @"password" })); }
/// <summary> /// Mapeamento referente ao botão de abrir o Menu /// </summary> public IImage AcessarMenu(IBrowser browser) { return(browser.Describe <IImage>(new ImageDescription { Alt = string.Empty, Index = 2, TagName = @"IMG", Type = HP.LFT.SDK.Web.ImageType.Normal })); }
public void AutomationPracticeTable() { Reporter.SnapshotCaptureLevel = HP.LFT.Report.CaptureLevel.All; IBrowser browser = BrowserFactory.Launch(BrowserType.Chrome); browser.Navigate("http://toolsqa.com/automation-practice-table/"); var mySearchValue = "Dubai"; //3) Get the value from cell ‘Dubai’ with using dynamic xpath var myCellValue = browser.Describe <IWebElement>(new WebElementDescription { TagName = @"TD", InnerText = @mySearchValue }).InnerHTML; Reporter.ReportEvent("Cell value:" + myCellValue, myCellValue); //4) Print all the column values of row ‘Clock Tower Hotel’ mySearchValue = "Clock Tower Hotel"; ITableRow myRow = browser.Describe <ITable>(new TableDescription { TagName = @"TABLE", Index = 0 }).FindRowWithCellText(@mySearchValue); Reporter.ReportEvent("Contents for row:" + @mySearchValue, ""); var firstEntry = true; foreach (ITableCell myCell in myRow.Cells) { if (firstEntry) { firstEntry = false; } else { Reporter.ReportEvent("Row contents:" + myCell.Text, myCell.Text); } } browser.Close(); }
/// <summary> /// mapeamento do botao Voltar /// </summary> public IWebElement BotaoVoltar(IBrowser browser) { return(browser.Describe <IFrame>(new FrameDescription { Name = @"toolbar" }) .Describe <IImage>(new ImageDescription { Alt = @"Voltar" })); }
/// <summary> /// mapeamento da tela inicial, para espera /// </summary> public IWebElement PagInicial(IBrowser browser) { return(browser.Describe <IFrame>(new FrameDescription { Name = @"principal" }) .Describe <IWebElement>(new WebElementDescription { TagName = @"BODY", XPath = @"//BODY" })); }
/// <summary> /// Mapemento referente ao popup Pendência /// </summary> /// <returns></returns> public IWebElement ClicaPopupPendencias(IBrowser Browser) { return(Browser.Describe <IFrame>(new FrameDescription { Name = @"toolbar2" }) .Describe <IWebElement>(new WebElementDescription { TagName = @"DIV", XPath = @"//DIV[1]" })); }
/// <summary> /// mapeamento do botao Alterar /// </summary> public IWebElement BotaoAlterar(IBrowser browser) { return(browser.Describe <IFrame>(new FrameDescription { Name = @"toolbar" }) .Describe <IImage>(new ImageDescription { Alt = @"Alterar", XPath = @"//SPAN[@id=""btn_acao_alterar""]/IMG[1]" })); }
/// <summary> /// mapeamento da mensagem "Operação realizada com sucesso" /// </summary> public IWebElement MsgOperacaoRealizadaComSucesso(IBrowser browser) { return(browser.Describe <IFrame>(new FrameDescription { Name = @"principal" }) .Describe <IWebElement>(new WebElementDescription { InnerText = @"Operação realizada com sucesso", XPath = @"//DIV[@id=""txt_msg""]" })); }
public void WhenISearchFor(string keyword) { //Get the Search field using Programmatic Descriptions IEditField searchField = browser.Describe <IEditField>(new EditFieldDescription { Type = @"search", TagName = @"INPUT", Name = @"q" }); //Set the keyword searchField.SetValue(keyword); //Get the Search button and click on it - shortcut way browser.Describe <IButton>(new ButtonDescription { ButtonType = @"submit", TagName = @"BUTTON", Name = @"Search" }).Click(); //Wait for Browser title to change browser.WaitUntil(b => b.Title.Equals("Search results for: '" + keyword + "'")); }
public void TestMethod1() { try { //Set reporter to take all snapshots Reporter.SnapshotCaptureLevel = HP.LFT.Report.CaptureLevel.All; //Navigate to Search Engine browser.Navigate("www.duckduckgo.com"); //Search for Learn2Automate blog IEditField txtSearch = browser.Describe <IEditField>(new EditFieldDescription { Type = "text", TagName = "INPUT", Name = "q" }); txtSearch.SetValue("learn2automate"); IButton btnSearch = browser.Describe <IButton>(new ButtonDescription { ButtonType = "submit", TagName = "INPUT", Name = "S" }); btnSearch.Click(); //Select the first search result ILink firstResult = browser.Describe <ILink>(new LinkDescription { TagName = "A", InnerText = As.RegExp(".*learn2automate.*"), Index = 0 }); Assert.IsTrue(firstResult.Exists(10)); firstResult.Click(); //Search for LeanFT if the blog opens IEditField searchBox = browser.Describe <IEditField>(new EditFieldDescription { Type = "text", TagName = "INPUT", Name = "s" }); Assert.IsTrue(searchBox.Exists(10)); searchBox.SetValue("leanft"); IButton goButton = browser.Describe <IButton>(new ButtonDescription { ButtonType = "submit", TagName = "INPUT", Name = "Go" }); goButton.Click(); //Verify that the blog entry with title LeanFT opens ILink blogResult = browser.Describe <ILink>(new LinkDescription { TagName = "A", InnerText = As.RegExp(".*leanfT.*"), Index = 0 }); Assert.IsTrue(blogResult.Exists(10)); blogResult.Highlight(); } catch (Exception e) { Reporter.ReportEvent("Look for LeanFT on Lean2Automate", e.Message); } }
public static IButton GetButton(IBrowser br, string controlname) { return br.Describe<IButton>(new ButtonDescription { Name = controlname }); }
public static IButton GetButton(IBrowser br, string controlname) { return(br.Describe <IButton>(new ButtonDescription { Name = controlname })); }
public static IEditField GetTextBox(IBrowser br, string controlname) { return(br.Describe <IEditField>(new EditFieldDescription { Name = controlname })); }
/// <summary> /// Mapeamento referente ao campo "Logar" /// </summary> /// <returns></returns> public IEditField campoBusca() { return(browser.Describe <IEditField>(new EditFieldDescription { CSSSelector = @"input#h_search-input", Name = @"conteudo", TagName = @"INPUT", Type = @"text" })); }
public void TestMethod2() { string fromText = "North Sydney Station"; string toText = "Town Hall Station"; IBrowser browser = BrowserFactory.Launch(BrowserType.Chrome); browser.Navigate("https://transportnsw.info/trip"); var fromBox = browser.Describe <IEditField>(new EditFieldDescription { Type = @"text", TagName = @"INPUT", Name = @"search-input-From" }); Boolean doesExits = fromBox.Exists(5); if (doesExits == true) { Reporter.ReportEvent("Box Exist Check", "Verify that Box exists value is= " + doesExits, HP.LFT.Report.Status.Passed); fromBox.SetValue(fromText); fromBox.Submit(); } else { Reporter.ReportEvent("Box Exist Check", "Verify that Box exists value is= " + doesExits, HP.LFT.Report.Status.Failed); } var toBox = browser.Describe <IEditField>(new EditFieldDescription { Type = @"text", TagName = @"INPUT", Name = @"search-input-To" }); doesExits = toBox.Exists(5); if (doesExits == true) { Reporter.ReportEvent("Box Exist Check", "Verify that Box exists value is= " + doesExits, HP.LFT.Report.Status.Passed); toBox.SetValue(toText); toBox.Submit(); } else { Reporter.ReportEvent("Box Exist Check", "Verify that Box exists value is= " + doesExits, HP.LFT.Report.Status.Failed); } var goButton = browser.Describe <IButton>(new ButtonDescription { ButtonType = @"button", Role = string.Empty, AccessibilityName = string.Empty, TagName = @"BUTTON", Name = @"Go", Index = 0 }); doesExits = goButton.Exists(5); if (doesExits == true) { Reporter.ReportEvent("Button Exist Check", "Verify that Button exists value is= " + doesExits, HP.LFT.Report.Status.Passed); goButton.Click(); } else { Reporter.ReportEvent("Button Exist Check", "Verify that Button exists value is= " + doesExits, HP.LFT.Report.Status.Failed); } }
public static IEditField GetTextBox(IBrowser br, string controlname) { return br.Describe<IEditField>(new EditFieldDescription { Name = controlname }); }
/// <summary> /// Mapeamento referente ao link "Nova Normativa de Vendas" /// </summary> public ILink ClickNovaNormativadeVendas(string normativadeVendas) { return(browser.Describe <IFrame>(new FrameDescription { Name = @"pesquisa" }) .Describe <ILink>(new LinkDescription { InnerText = @"" + normativadeVendas + "", TagName = @"A" })); }
public static ILink GetLink( IBrowser br, string linktext) { return br.Describe<ILink>(new LinkDescription { InnerText = linktext }); }