private void btnNavigate_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbUrl.Text)) { webBrowser.Navigate(tbUrl.Text); } }
public void GoToUrl(string url) { if (url == null) { return; } _browser.Navigate(url); }
void InitializeCommunicator(int rpHostProcessID) { r_Communicator = new MemoryMappedFileCommunicator($"Sakuno/HeavenlyWind({rpHostProcessID})", 4096); r_Communicator.ReadPosition = 0; r_Communicator.WritePosition = 2048; r_Messages = r_Communicator.GetMessageObservable().ObserveOnDispatcher().Publish(); r_Messages.Connect(); r_Communicator.StartReader(); r_Messages.Subscribe(CommunicatorMessages.ClearCache, _ => r_BrowserProvider?.ClearCache(false)); r_Messages.Subscribe(CommunicatorMessages.ClearCacheAndCookie, _ => r_BrowserProvider?.ClearCache(true)); r_Messages.Subscribe(CommunicatorMessages.GoBack, _ => r_Browser?.GoBack()); r_Messages.Subscribe(CommunicatorMessages.GoForward, _ => r_Browser?.GoForward()); r_Messages.Subscribe(CommunicatorMessages.Navigate, rpUrl => r_Browser?.Navigate(rpUrl)); r_Messages.Subscribe(CommunicatorMessages.Refresh, _ => r_Browser?.Refresh()); r_Messages.Subscribe(CommunicatorMessages.SetZoom, r => { r_Zoom = double.Parse(r); r_Browser?.SetZoom(r_Zoom); r_Communicator.Write(CommunicatorMessages.InvalidateArrange); }); r_Messages.Subscribe(CommunicatorMessages.ResizeBrowserToFitGame, _ => { r_Container.Width = GameConstants.GameWidth * r_Zoom / DpiUtil.ScaleX / DpiUtil.ScaleX; r_Container.Height = GameConstants.GameHeight * r_Zoom / DpiUtil.ScaleY / DpiUtil.ScaleY; r_Communicator.Write(CommunicatorMessages.InvalidateArrange); }); InitializeScreenshotMessagesSubscription(); }
public void TestGithub() { var eyes = new Eyes(new Uri("https://demo.applitools.com")); Applitools.Tests.Utils.TestUtils.SetupLogging(eyes); eyes.ForceFullPageScreenshot = true; eyes.StitchMode = StitchModes.CSS; eyes.HideScrollbars = true; eyes.BaselineEnvName = "Desktop Web - LeanFT"; eyes.MatchLevel = MatchLevel.Layout; IBrowser testBrowser = BrowserFactory.Launch(HP.LFT.SDK.Web.BrowserType.Chrome); try { eyes.Open(testBrowser, "Github", "Github envs", new System.Drawing.Size(800, 600)); testBrowser.Navigate("https://www.github.com"); eyes.CheckWindow("Search"); eyes.Close(); } finally { eyes.AbortIfNotClosed(); testBrowser.Close(); } }
public void TestInitialize() { browser = BrowserFactory.Launch(BrowserType.Chrome); browser.Navigate(ConfigurationManager.AppSettings[Constants.EXERCISE_LINK]); browser.Sync(); am = new ActionsMahara(browser); }
//public decimal SchottCount { get; set; } //public decimal SchottTotalSize { get; set; } private void ChageBrowser(BrowserType browserType) { panel_Browser.Controls.Clear(); Control browserControl = null; switch (browserType) { case BrowserType.Trident: { browserControl = new TridentBrowser(); image_Icon.Image = Resources.ie; } break; //case BrowserType.Webkit: // { // browserControl = new WebkitBrowser(); // image_Icon.Image = Resources.Webkit; // } break; } browserControl.Dock = DockStyle.Fill; panel_Browser.Controls.Add(browserControl); browser = browserControl as IBrowser; browser.ScrollBarsEnabled = true; browser.Navigating += WebBrowserNavigating; browser.Navigated += WebBrowserNavigated; browser.Navigate(new Uri("http://yahoo.co.jp/")); webBrowser_SizeChanged(null, null); }
public void TestInitialize() { browser = BrowserChoose.GetBrowser(TestContext.DataRow); browser.Navigate("http://market.yandex.ru"); marketMainPage = new ApplicationModel(browser); }
static void Main(string[] args) { SdkConfiguration config = new SdkConfiguration(); config.ServerAddress = new Uri("ws://*****:*****@gmail.com"); cretepage.tbphone.SetValue("976812570"); cretepage.tbaddress.SetValue("Airoli NaviMumbai"); cretepage.btnsubmit.Click(); }
public static void LaunchApplication() { IBrowser browser = BrowserFactory.Launch(BrowserType.InternetExplorer); TestController.Instance.Browser = browser; browser.Navigate("http://www.bol.com/nl"); TestController.Instance.Model = new ApplicationModel(browser); }
public void SetUp() { #region Create and start browser browserType = BrowserType.Chrome; browser = BrowserFactory.Launch(browserType); browser.Navigate(baseUri); appModel = new AOBModel(browser); #endregion }
public void TestMethod1() { string fromCode = "10101112"; string toCode = "10101101"; IBrowser browser = BrowserFactory.Launch(BrowserType.Chrome); browser.Navigate("https://transportnsw.info/trip#/?from=" + fromCode + "&to=" + toCode); }
/// <summary> /// Authorizes the asynchronous. /// </summary> /// <param name="sdkClient">The SDK client.</param> /// <param name="browser">The browser.</param> /// <param name="clientId">The client identifier.</param> /// <param name="returnUrl">The return URL.</param> /// <param name="completeCallback">The complete callback.</param> public static void AuthorizeAsync(this IDiskSdkClient sdkClient, IBrowser browser, string clientId, string returnUrl, EventHandler <GenericSdkEventArgs <string> > completeCallback) { retUrl = returnUrl; completeHandler = completeCallback; var authUrl = string.Format(WebdavResources.AuthBrowserUrlFormat, clientId); browser.Navigating += BrowserOnNavigating; browser.Navigate(authUrl); }
public void SetUp() { // Before each test browser = BrowserFactory.Launch(BrowserType.Firefox); browser.ClearCache(); browser.Navigate(@"http://abcbank.orasi.com"); loginPage = new LoginPage(browser); //bankOR = new BankOR(browser); }
public BrowserElement(BrowserSelector selector) { InitializeComponent(); _browserProvider = selector.SelectedBrowser; DataContext = _browser = _browserProvider.CreateBrowser(); _browser?.Navigate(selector.DefaultUrl.Value); Application.Current.Exit += OnApplicationExit; }
public void SetUp() { // Before each test browser = BrowserFactory.Launch(BrowserType.InternetExplorer); browser.Navigate("https://auto-buy-gz-user1.geico.com/"); GeicoApp GAM = new GeicoApp(browser); GAM.ErrorPage.ContinueLink.Click(); customer = new CustomerInfoPage(browser); vehicle = new VehicleInfoPage(browser); }
public void TestInitialize() { //Open the Internet Exolorer Browser browser = BrowserFactory.Launch(BrowserType.InternetExplorer); //Navigate to the Application browser.Navigate("http://demo.magentocommerce.com/"); browser.Sync(); //Initialize the Application model app = new MagentoCommerce(browser); }
public static void Main(string[] args) { // Init the LeanFT SDK SDK.Init(new SdkConfiguration()); // Open a Chrome browser IBrowser testBrowser = BrowserFactory.Launch(BrowserType.Chrome); // Initialize the eyes SDK and set your private API key. var eyes = new Eyes(); eyes.ServerUrl = "https://localhost.applitools.com"; try { // Start the test and set the browser's viewport size to 800x600 eyes.Open(testBrowser, "Hello World!", "My first LeanFT C# test", new Size(800, 600)); // Navigate the browser to the "hello world!" web-site. testBrowser.Navigate("https://www.applitools.com/helloworld"); // Visual checkpoint #1 eyes.CheckWindow("Hello!"); // Click the "Click me!" button IWebElement button = testBrowser.FindChildren <IWebElement>(new WebElementDescription { TagName = "button" })[0]; button.Click(); // Visual checkpoint #2 eyes.CheckWindow("Click!"); // End the test eyes.Close(); } catch (Exception ex) { Console.WriteLine(ex); } finally { // Close the browser. testBrowser.Close(); // If the test was aborted before eyes.Close was called, ends the test as aborted. eyes.AbortIfNotClosed(); // Close the LeanFT SDK SDK.Cleanup(); } }
public void TestFixtureSetUp() { // Setup once per fixture // Optional to turn on snapshots on every step. It can be set here this way // or by making modifications to the App.config file Reporter.SnapshotCaptureLevel = HP.LFT.Report.CaptureLevel.All; // Initially create an instance of the browser and navigate to the AdVantage home page AdVantBrowser = BrowserFactory.Launch(BrowserType.InternetExplorer); AdVantBrowser.Navigate("http://alm-aob:47001/advantage/"); //AdVantBrowser.Navigate("http://15.126.221.115:47001/advantage/"); // Create a new instance of the Application Model MyVantModel = new VantModel(AdVantBrowser); }
private void buttonRun_Click(object sender, EventArgs e) { // Twebst automation code for hosted WebBrowser control. // Attach to native IWebBrowser2 object. If this code runs in other thread than UI thread you need // to marshal IWebBrowser2 object; see CoMarshalInterThreadInterfaceInStream in MSDN // http://msdn.microsoft.com/en-us/library/windows/desktop/ms693316(v=vs.85).aspx IBrowser browser = core.AttachToNativeBrowser((SHDocVw.IWebBrowser2) this.webBrowser.ActiveXInstance); // Or you can attach directly to Win32 window handle. Reccomended if you automate WebBrowser // from another thread because you don't need to marshal any COM object. // IBrowser browser = core.AttachToHWND(this.webBrowser.Handle.ToInt32()); browser.Navigate("http://codecentrix.com/doc/playground.htm"); // Find "Email" editbox control. IElement elem = browser.FindElement("input text", "id=email"); elem.InputText("*****@*****.**"); // Find "Password" editbox control. elem = browser.FindElement("input text", "id=password"); elem.InputText("notarealpwd"); // Automate a list box. elem = browser.FindElement("select", "id=cntry"); elem.Select("Romania"); // Automate check box and radio. elem = browser.FindElement("input radio", "id=r3"); elem.Check(); elem = browser.FindElement("input checkbox", ""); elem.Check(); // Modify the HTML document. elem = browser.FindElement("div", "id=deev"); elem.nativeElement.innerText = "just changed"; // Automate inside iframe. elem = browser.FindElement("a", "uiName=Download"); elem.Click(); // !!!!!! ALERT: // Some features don't work with hosted WebBrowser yet: closePopup, upload controls, modal and modeless HTML dialog boxes. }
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(); }
public void UI01_Adiciona_Compra_Carrinho() { SDK.Init(new SdkConfiguration()); Reporter.Init(new ReportConfiguration()); IBrowser browser = BrowserFactory.Launch(BrowserType.InternetExplorer); // CLASSES A SEREM UTILIZADAS // var basePage = new BasePage(browser); var loginPage = new LoginPage(browser); var pesquisaBuscaPage = new PesquisaBuscaPage(browser); var dados = new Dados(); var basePage = new BasePage(browser); // VARIAVEIS DE APOIO string produto = "celulares"; string produtoSelecionado; //INICIO DO FLUXO DO CASO DE TESTE browser.Navigate(dados.UrlAmericanasPageInicial); basePage.gerarEvidencias("UI001"); loginPage.loginSisAmil(dados.Username, dados.Senha); //VALIDAR SUSGESTÃO REFERENTE À BUSCA pesquisaBuscaPage.caixaSugestaoDeBusca(produto); //SELECIONA PRODUTO E ARMAZENA REFERENCIA produtoSelecionado = pesquisaBuscaPage.armazenaReferenciaProduto(); //armazena a descrição do produto para comparar replicação correta em "Cesto de compras" pesquisaBuscaPage.clicarProduto(); //SELECIONA GARANTIA EXTENDIDA pesquisaBuscaPage.selecionaGarantia(); //ACESSAR CESTO DE COMPRAS pesquisaBuscaPage.acessaCestoCompras(); //FIM DO FLUXO DO CASO DE TESTE browser.Close(); Reporter.GenerateReport(); SDK.Cleanup(); }
public BrowserElement(BrowserSelector selector, LayoutSetting layoutSetting) { InitializeComponent(); _browserProvider = selector.SelectedBrowser; ActualContent.Content = DataContext = _browser = _browserProvider?.CreateBrowser(); if (_browser is null) { Visibility = Visibility.Collapsed; } else { _browser.LockGame = true; _browser.Navigate(selector.Settings.DefaultUrl.Value); layoutSetting.LayoutScale.ValueChanged += _ => UpdateScale(); layoutSetting.BrowserScale.ValueChanged += _ => UpdateScale(); Loaded += (s, e) => UpdateScale(); this.layoutSetting = layoutSetting; } Application.Current.Exit += OnApplicationExit; }
public void HomePageTest() { browser.Navigate("http://localhost"); // ********* Home Page Object Model ************************ ; HomePage home = new HomePage(); home.brhomepage = browser; home.lnkphpsamples.Click(); // ******* PHP Samples Object Model ************************ PHPSamples phpsmpleslist = new PHPSamples(); phpsmpleslist.brphpsampleslistpage = browser; phpsmpleslist.lnkcreatelist.Click(); // ******* Create List Page Object List ************************ CreateListPage cretepage = new CreateListPage(); cretepage.brcreatelistpage = browser; cretepage.tbfistname.SetValue("Prasanna"); cretepage.tblastname.SetValue("Hegde"); cretepage.tbemail.SetValue("*****@*****.**"); cretepage.tbphone.SetValue("976812570"); cretepage.tbaddress.SetValue("Airoli NaviMumbai"); cretepage.btnsubmit.Click(); }
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 void GivenIAmOnTheShopWebSite() { browser = BrowserFactory.Launch(BrowserType.Chrome); browser.Navigate("https://www.edgewordstraining.co.uk/demo-site"); }
public void GivenIAmInTheSite() { //browser.Navigate("http://nimbusserver:8080/#/"); browser.Navigate("http://www.advantageonlineshopping.com/#/"); }
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 void read_attribute() { browser.Navigate(new Uri("http://google.ro")).Wait(); Assert.AreEqual(browser.Page.Root.Query("#hplogo").GetAttribute("align"), "left"); }
public string Authorize(string userName, string password) { _browser.Navigate(GetLogonUri(userName, password), false); return((_browser.Html ?? "network").ToLower()); }
private void myNavigateMenu_Click(object sender, EventArgs e) { myBrowser.Navigate(myItemProperties.SelectedGridItem.Value.ToString()); }
private Task BrowserInitialize(IBrowser browser, string icn, CancellationToken ct) { return Task.Run(async () => { await browser.Navigate(ModuleConfiguration.Url, ct); do { var isJquery = (bool)await browser.ExecuteJs("return jQuery != null", ct); if (isJquery) break; await browser.Refresh(ct); } while (true); await browser.ExecuteJs( "window.fragma=window.fragma||{},fragma.modules=fragma.modules||{},void 0===fragma.modules.cities&&(fragma.modules.cities=new function(){var e=this,t=function(e,t,i,n,r){i.hide(),t.val(e),t.keydown();var a=[],o=function(){return i.is(':visible')?$.each(i.find('a'),function(e,t){var i=$(t);a.push(i.html())}):t.val()!=e&&a.push(t.val()),a.length>0?(n.waitHandler=null,void r(a)):void(n.waitHandler=setTimeout(o,100))};n.waitHandler=setTimeout(o,30)};e.senderContext={cities:[],waitHandler:null},e.receiverContext={cities:[],waitHandler:null},e.getSenderCity=function(i){e.senderContext.cities=[],e.senderContext.waitHandler&&(clearTimeout(e.senderContext.waitHandler),e.senderContext.waitHandler=null);var n=$('input[name=\"from_ship\"]'),r=$($('ul.ui-autocomplete')[0]);t(i,n,r,e.senderContext,function(t){e.senderContext.cities=t})},e.getReceiverCity=function(i){e.receiverContext.cities=[],e.receiverContext.waitHandler&&(clearTimeout(e.receiverContext.waitHandler),e.receiverContext.waitHandler=null);var n=$('input[name=\"to_send\"]'),r=$($('ul.ui-autocomplete')[1]);return t(i,n,r,e.receiverContext,function(t){e.receiverContext.cities=t})}});", ct); await browser.ExecuteJs( "window.fragma=window.fragma||{},fragma.modules=fragma.modules||{},void 0===fragma.modules.tariffs&&(fragma.modules.tariffs=new function(){var a=this;a.getTariffs=function(){for(var a=[],n=$('.style_table').find('tr'),r=1;r<n.length;++r){var f=$(n[r]);$columns=f.find('td');var s=$columns[0].innerHTML,m=$($columns[1]).find('b').html(),i=$columns[2].innerHTML;a.push(s),a.push(m),a.push(i)}return a}});", ct); if (!await browser.Select("input[name='login']", ct)) throw new InvalidOperationException("Can't find login input"); await browser.Input(ModuleConfiguration.Login, ct); if (!await browser.Select("input[name=pass]", ct)) throw new InvalidOperationException("Can't find password input"); await browser.Input(ModuleConfiguration.Password, ct); if (!await browser.WaitForAjax(5000, ct)) throw new TimeoutException("Failed to wait for icn input to show"); //await WaitFor("Failed to wait for icn input to show", 20, () => //{ // return _browser.IsElementVisible("div#loginform input[name=icn]", ct); //}, ct); if (!await browser.Select("input[name=icn]", ct)) throw new InvalidOperationException("Can't find icn input"); await browser.Input(icn, ct); await browser.Select("#submit", ct); if (!await browser.WaitForAjax(10000, ct)) throw new TimeoutException("Login operation proceeded too long"); }, ct); }
public void ShouldTakeMeToHomePage() { _browser.Navigate(ConfigurationManager.AppSettings.Get("AppURI")); }
public void Open(string url) { _browser.Navigate().GoToUrl(url); }