public void MyTestInitialize() { //lp = new LoginPage(); browserName = TestContext.Properties["Browser"].ToString(); BrowserHelpers.CreateDriver(browserName); test = extent.CreateTest(TestContext.TestName); }
public void NewWindowTitleTest(string title) { ClickButton(newWindowButton); BrowserHelpers.SwitchWindow(Driver); CheckHelpers.CompareText(Driver, title); BrowserHelpers.CloseWindow(Driver); }
public void LargeModalWindowTest(string text) { ClickButton(largeModalButton); WaitHelpers.WaitPresentElement(modalWindow, Wait); CheckHelpers.CompareText(BrowserHelpers.GetDialogText(Driver), text); ClickButton(closeLargeDialogButton); BrowserHelpers.IsDialogShown(Driver, modalWindow); }
public static string GetValorCss(this Element elemento, IBrowser browser) { var iWebElement = BrowserHelpers.ObterIWebElement(browser, elemento); string valorAtributo = browser.ObterDriver().FindElement(elemento.ObterBy()).GetAttribute("textContent"); return(valorAtributo); }
public void NewTabTitleTest(string title) { ClickButton(newTabButton); BrowserHelpers.SwitchTab(Driver, 1); CheckHelpers.CompareText(Driver, title); BrowserHelpers.CloseTab(Driver, 1); BrowserHelpers.SwitchTab(Driver, 0); }
private void ClicarNovoAmbiente() { LinkNovoAmbiente.EsperarElemento(Browser); if (LinkNovoAmbiente.IsElementVisible(Browser)) { MouseActions.ClickATM(Browser, LinkNovoAmbiente); } BrowserHelpers.EliminarAlertasChrome(Browser); }
public static bool IsElementPresent(this Element elemento, IBrowser browser) { var wait = new WebDriverWait(browser.ObterDriver(), TimeSpan.FromSeconds(SEGUNDOS_TIMEOUT_ELEMENTO)); wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(elemento.ObterBy())); var iWebElement = BrowserHelpers.ObterIWebElement(browser, elemento); return(iWebElement.Displayed); }
private void AdicionarMaisAmbientes(string nomeAmbiente) { BtnAdicionarMaisAmbientes.EsperarElemento(Browser); MouseActions.ClickATM(Browser, BtnAdicionarMaisAmbientes); BrowserHelpers.EliminarAlertasChrome(Browser); if (InputNomeAdicionarAmbiente.IsElementVisible(Browser)) { AutomatedActions.SendDataATM(Browser, InputNomeAdicionarAmbiente, nomeAmbiente); } }
public static bool IsClickable(this Element elemento, IBrowser browser) { var iWebElement = BrowserHelpers.ObterIWebElement(browser, elemento); browser.ObterDriver().Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(SEGUNDOS_TIMEOUT_ELEMENTO); elemento.EsperarElemento(browser); // var wait = new WebDriverWait(browser.ObterDriver(), TimeSpan.FromSeconds(SEGUNDOS_TIMEOUT_ELEMENTO)); // wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(elemento.ObterBy())); return(iWebElement.Displayed); }
private void AdicionarNovoCenario(string nomeCenario) { BtnNovoCenario.Esperar(Browser, 1000); BtnNovoCenario.EsperarElemento(Browser); if (BtnNovoCenario.IsElementVisible(Browser)) { MouseActions.ClickATM(Browser, BtnNovoCenario); } BrowserHelpers.EliminarAlertasChrome(Browser); AutomatedActions.SendDataATM(Browser, InputNomeNovoCenario, nomeCenario); }
public void FillFields(string value, string carName) { ClickButton(selectValueField); ClickButton(selectValue); ClickButton(selectOneField); ClickButton(selectValue); BrowserHelpers.SelectDropDownValueByText(oldStyleMenu, value, Wait); ClickButton(multiselectDropDown); ClickButton(selectValue); ClickButton(selectSecondValue); KeysHelpers.PressEnter(Wait, standartMultiselect); BrowserHelpers.SelectDropDownValueByText(standartMultiselect, carName, Wait); }
//added for demo to switch into frame public void framehandling() { //frame window button // IWebElement selectDD1 = driver.FindElement(By.Id("menulist2")); //SelectElement dd1 = new SelectElement(selectDD1); //dd1.SelectByText("Boost");3d driver.SwitchTo().Frame("frame1"); IWebElement selectDDframe = driver.FindElement(By.Id("menulist2")); SelectElement ddframe = new SelectElement(selectDDframe); Assert.AreEqual("Coffee", ddframe.SelectedOption.Text); BrowserHelpers.screenshots("Before select Boost"); ddframe.SelectByText("Boost"); BrowserHelpers.screenshots("After select Boost"); //parent window button driver.SwitchTo().DefaultContent(); IWebElement selectDD = driver.FindElement(By.Id("menulist")); SelectElement dd = new SelectElement(selectDD); dd.SelectByText("Pongal"); }
public static void ClicarInteligente(this Element elemento, IBrowser browser) { var sucesso = false; var execucoes = 3; while (!sucesso && execucoes > 0) { try { execucoes--; BrowserHelpers.ObterIWebElement(browser, elemento).Click(); sucesso = true; } catch (Exception) { Thread.Sleep(SEGUNDOS_TIMEOUT_ELEMENTO); if (execucoes == 0) { throw new ElementoNaoEncontrado($"O elemento {elemento} não foi encontrado."); } } } }
public void SmallFrameTest(string text) { BrowserHelpers.SwitchFrame(Driver, smallFrame); CheckHelpers.CompareText(Wait, frameText, text); }
public static bool IsElementSelected(this Element elemento, IBrowser browser) { var iWebElement = BrowserHelpers.ObterIWebElement(browser, elemento); return(iWebElement.Selected); }
public void EditarAmbiente(string editarAmbiente) { ClicarBtnEditarCenario(); BrowserHelpers.EliminarAlertasChrome(Browser); EditarNovoAmbiente(editarAmbiente); }
public static bool IsElementVisible(this Element elemento, IBrowser browser) { var iWebElement = BrowserHelpers.ObterIWebElement(browser, elemento); return(iWebElement.Displayed && iWebElement.Enabled); }
private void EditarNovoCenario(string tipoCenario, string editarCenario) { SelecionarTipoCenario(tipoCenario); BrowserHelpers.EliminarAlertasChrome(Browser); PreencherNovoCenario(editarCenario); }
protected override async Task ExecuteAsync(CancellationToken stopToken) { bool start = true; await Task.Delay(1); if (!MainDataContext.WalletHandler.ReloadAccounts()) { Console.WriteLine("Cannot reload accounts"); } if (EconomyMainContext.StartBrowserAtStart) { BrowserHelpers.OpenBrowser($"http://localhost:{EconomyMainContext.MainPort}/"); } try { if (EconomyMainContext.WorkWithQTRPC) { EconomyMainContext.QTRPCClient.InitClients(); NeblioTransactionHelpers.qtRPCClient.InitClients(); } } catch (Exception ex) { log.Error("Cannot init QTRPC Client! Please check settings in appsetting.json", ex); } try { _ = Task.Run(async() => { while (!stopToken.IsCancellationRequested) { try { // first wait until MQTT client exists and it is connected to the broker if (EconomyMainContext.MQTTClient != null) { while (!EconomyMainContext.MQTTClient.IsConnected && !stopToken.IsCancellationRequested) { // wait until client is started and connected to broker await Task.Delay(500); } if (start && EconomyMainContext.MQTTClient.IsConnected) { await EconomyMainContext.MQTTClient.PostObjectAsJSONString("VEF/Start", "Virtual Economy Framework started"); start = false; } else if (!start && EconomyMainContext.MQTTClient.IsConnected) { // wait for specified time - time interval you can set i appsetting.json await Task.Delay(EconomyMainContext.WalletRefreshInterval); // this will refresh all wallets data without loading transaction details await MainDataContext.WalletHandler.RefreshWallets(); if (!MainDataContext.WalletHandler.ReloadAccounts()) { Console.WriteLine("Cannot reload accounts"); } //these commands publish main dictionaries to MQTT each interval await EconomyMainContext.MQTTClient.PostObjectAsJSON <IDictionary <string, IWallet> >( "VEF/Wallets", EconomyMainContext.Wallets); await EconomyMainContext.MQTTClient.PostObjectAsJSON <IDictionary <string, IAccount> >( "VEF/Accounts", EconomyMainContext.Accounts); await EconomyMainContext.MQTTClient.PostObjectAsJSON <IDictionary <string, INode> >( "VEF/Nodes", EconomyMainContext.Nodes); await EconomyMainContext.MQTTClient.PostObjectAsJSON <IDictionary <string, ICryptocurrency> >( "VEF/Cryptocurrencies", EconomyMainContext.Cryptocurrencies); //await MainDataContext.MQTTClient.PostObjectAsJSON<IDictionary<string, IOwner>>( // "VEF/Owners", MainDataContext.Owners); } } } catch (Exception ex) { log.Error("Error occured in WalletHandlerCore.", ex); log.Info("Trying again within 1s."); await Task.Delay(1000); } } log.Info($"Virtual Economy Framework wallet handler task stopped"); }); } catch (Exception ex) { log.Fatal("Cannot start Virtual Economy server wallet handler", ex); lifetime.StopApplication(); } }
// [TearDown] public void MyTestCleanup() { test.Log(Status.Pass, "User name page displayed successfully."); BrowserHelpers.CloseDriver(); }
private void EditarNovoCenarioGROTRegiao(string regiao) { BrowserHelpers.EliminarAlertasChrome(Browser); PreencherNovaRegiao(regiao); }
public void TC010_AutoITDemo() { lp.GotoPage(URL); BrowserHelpers.screenshots("DemoHTMLPage"); lp.callingAutoITExe(); }
public static void SelectElementATMByValue <T>(T browser, Element elemento, string texto) where T : IBrowser { var selectElement = new SelectElement(BrowserHelpers.ObterIWebElement(browser, elemento)); selectElement.SelectByValue(texto); }
public void NewWindowMessageTitleTest() { ClickButton(newWindowMessageButton); BrowserHelpers.CloseWindow(Driver); BrowserHelpers.SwitchTab(Driver, 0); }
public void ClickSubItem() { BrowserHelpers.HoverMouse(mainItem2, Driver); BrowserHelpers.HoverMouse(subList, Driver); WaitHelpers.WaitClicableElement(subItem, Wait); }