private static DriverScope GetSelectScope(string locator) { var select = new BrowserWindow(DefaultSessionConfiguration, new SelectFinder(Driver, locator, Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); return @select; }
public void Can_fill_in_a_text_input_within_an_iframe() { var iframeOne = new BrowserWindow(DefaultSessionConfiguration, new FrameFinder(Driver, "I am iframe one", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); Driver.Set(FindField("text input in iframe", iframeOne), "filled in"); Assert.That(FindField("text input in iframe", iframeOne).Value, Is.EqualTo("filled in")); }
internal void ShowShapewaysLogin(ShapewaysClient client) { context.Send((_) => { var window = new BrowserWindow(new Uri(client.LoginUrl)) { Title = "Shapeways", Owner = parent, WindowStartupLocation = WindowStartupLocation.CenterOwner, Height = 500, Width = 1000 }; window.Browser.LoadCompleted += (sender, args) => { if (args.Uri.AbsolutePath == "/callbackDynamoShapeways") { client.SetToken(args.Uri.PathAndQuery); window.Close(); } }; window.Browser.Loaded += (sender, args) => { HideScriptErrors(window.Browser, true); }; window.ShowDialog(); }, null); }
public SilverlightDocument(AutomationElement automationElement, BrowserWindow actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { ieWindow = actionListener; }
public void Finds_clear_scope_back_to_the_whole_window() { var iframeOne = new BrowserWindow(DefaultSessionConfiguration, new FrameFinder(Driver, "I am iframe one", Root, DefaultOptions), Driver,null,null,null,DisambiguationStrategy); Button("scoped button", iframeOne, DefaultOptions).Id.should_be("iframe1ButtonId"); Button("scoped button", Root, Options.PreferExact).Id.should_be("scope1ButtonId"); }
public void Gets_location_for_correct_window_scope() { Driver.Click(Link("Open pop up window")); var popUp = new BrowserWindow(DefaultSessionConfiguration, new WindowFinder(Driver, "Pop Up Window", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); Assert.That(Driver.Location(popUp).AbsoluteUri, Is.StringEnding("src/Coypu.Drivers.Tests/html/popup.htm")); }
public UITestControl Gui(string controlName, BrowserWindow bw) { try { IEnumerable<DataRow> query = from row in controlInfo.AsEnumerable() where row.Field<string>(RetControl.UIName) == controlName select row; if (query.Count() != 0) { HtmlControl target; DataTable dt = query.CopyToDataTable<DataRow>(); string type = dt.Rows[0].Field<string>(RetControl.UIType); target = ConvertStr2ControlObj(type, bw) as HtmlControl; foreach (DataRow row in dt.Rows) { string property = row.Field<string>(RetControl.UIProperty); string propValue = row.Field<string>(RetControl.PropValue); target.SearchProperties[property] = propValue; } return target; } else { throw new RetrieveControlFailException(controlName); } } catch (Exception ex) { throw ex; } }
public bool ShowLogin(object o) { var url = new Uri(o.ToString()); if (o == null) throw new ArgumentException(Dynamo.Wpf.Properties.Resources.InvalidLoginUrl); var navigateSuccess = false; // show the login context.Send((_) => { var window = new BrowserWindow(url) { Title = Dynamo.Wpf.Properties.Resources.AutodeskSignIn, Owner = parent, WindowStartupLocation = WindowStartupLocation.CenterOwner }; window.Browser.Navigated += (sender, args) => { // if the user reaches this path, they've successfully logged in // note that this is necessary, but not sufficient for full authentication if (args.Uri.LocalPath == "/OAuth/Allow") { navigateSuccess = true; window.Close(); } }; window.ShowDialog(); }, null); return navigateSuccess; }
public void Can_scope_around_an_iframe() { var iframeOne = new BrowserWindow(DefaultSessionConfiguration, new FrameFinder(Driver, "I am iframe one", Root,DefaultOptions), Driver, null, null, null, DisambiguationStrategy); Button("scoped button", iframeOne, DefaultOptions).Id.should_be("iframe1ButtonId"); var body = new BrowserWindow(DefaultSessionConfiguration, new CssFinder(Driver, "body", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); Button("scoped button", body, Options.PreferExact).Id.should_be("scope1ButtonId"); }
private static void Finds_elements_among_multiple_scopes(ElementFinder elementFinder1, ElementFinder elementFinder2) { var iframeOne = new BrowserWindow(DefaultSessionConfiguration, elementFinder1, Driver, null, null, null, DisambiguationStrategy); var iframeTwo = new BrowserWindow(DefaultSessionConfiguration, elementFinder2, Driver, null, null, null, DisambiguationStrategy); Button("scoped button", iframeOne, DefaultOptions).Id.should_be("iframe1ButtonId"); Button("scoped button", iframeTwo, DefaultOptions).Id.should_be("iframe2ButtonId"); }
private WebPageCollection(BrowserWindow broswerWindow, CacheProvider cacheProvider = null) { Browser = broswerWindow; Cache = cacheProvider; WebPages = new Dictionary<string, WebPage>( ); if ( Cache != null ) { WebPages = Cache.LoadWebPageCollectionFromCache( this.Browser ); } }
private void TakeScreenshot_acts_immediately_on_driver(BrowserWindow mainWindow) { mainWindow.SaveScreenshot("save-me-here.png", ImageFormat.Png); var saveScreenshotCall = driver.SaveScreenshotCalls.Single(); Assert.That(saveScreenshotCall.Request, Is.EqualTo("save-me-here.png")); Assert.That(saveScreenshotCall.Scope, Is.EqualTo(mainWindow)); }
public HoneywellFirstLoginLogoff(BrowserWindow window) { _browser = window; _usernameBox = new xHtmlEdit(_browser, "UserName"); _passwordBox = new xHtmlEdit(_browser, "Password"); _loginBtn = new xHtmlButton(_browser, "submit", "Type"); _profileBtn = new xHtmlHyperlink(_browser, "newyork_admin ", "FriendlyName"); _logoffBtn = new xHtmlHyperlink(_browser, "Logoff", "FriendlyName"); }
public void LaunchBrowser_Keep(string url, bool cleanup) { BrowserWindow.CurrentBrowser = Parameters.browser; browser = BrowserWindow.Launch(new Uri(url)); browser.CloseOnPlaybackCleanup = cleanup; if (Parameters.browser == "ie") { browser.Maximized = true; } }
public void TestCreatePage() { var window = new BrowserWindow(); var pageFunc = PageBuilder<BrowserWindow, HtmlDocument>.CreateElement(typeof(BuildPage)); var pageObject = pageFunc(window, null, null); var page = pageObject as BuildPage; Assert.IsNotNull(page); Assert.AreEqual("/builds", page.FilterProperties[HtmlDocument.PropertyNames.AbsolutePath]); Assert.AreEqual("http://localhost:2222/builds", page.FilterProperties[HtmlDocument.PropertyNames.PageUrl]); Assert.IsNotNull(page.TestButton); Assert.AreEqual("MyControl", page.TestButton.SearchProperties[HtmlControl.PropertyNames.Id]); Assert.AreEqual("The Button", page.TestButton.FilterProperties[HtmlButton.PropertyNames.DisplayText]); Assert.IsNotNull(page.UserName); Assert.AreEqual("UserName", page.UserName.SearchProperties[UITestControl.PropertyNames.Name]); Assert.AreEqual("Bob", page.UserName.FilterProperties[HtmlEdit.PropertyNames.Text]); Assert.IsNotNull(page.Image); Assert.AreEqual("The Image", page.Image.FilterProperties[HtmlImage.PropertyNames.Alt]); Assert.AreEqual("http://myimage", page.Image.FilterProperties[HtmlImage.PropertyNames.Src]); Assert.IsNotNull(page.Hyperlink); Assert.AreEqual("The Hyperlink", page.Hyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Alt]); Assert.AreEqual("http://myHyperlink", page.Hyperlink.FilterProperties[HtmlHyperlink.PropertyNames.Href]); Assert.IsNotNull(page.HyperlinkArea); Assert.AreEqual("The Hyperlink Area", page.HyperlinkArea.FilterProperties[HtmlAreaHyperlink.PropertyNames.Alt]); Assert.AreEqual("http://myHyperlinkArea", page.HyperlinkArea.FilterProperties[HtmlAreaHyperlink.PropertyNames.Href]); // Nesting Test Assert.IsNotNull(page.MyDiv); Assert.AreEqual("MyDiv", page.MyDiv.SearchProperties[HtmlControl.PropertyNames.Id]); Assert.AreEqual("The Div!", page.MyDiv.FilterProperties[HtmlControl.PropertyNames.InnerText]); Assert.AreEqual("btn", page.MyDiv.FilterProperties[UITestControl.PropertyNames.ClassName]); Assert.AreEqual("The Main Div", page.MyDiv.FilterProperties[HtmlControl.PropertyNames.Title]); Assert.IsNotNull(page.MyDiv.InternalButton); Assert.AreEqual("InternalItem", page.MyDiv.InternalButton.SearchProperties[HtmlControl.PropertyNames.Id]); //List Test Assert.IsNotNull(page.MyCollection); Assert.IsInstanceOfType(page.MyCollection, typeof(CodedUIListElementWrapper<HtmlDiv, ListItem>)); var propertyList = (CodedUIListElementWrapper<HtmlDiv, ListItem>)page.MyCollection; Assert.IsNotNull(propertyList.Parent); Assert.AreEqual("ListDiv", propertyList.Parent.SearchProperties[HtmlControl.PropertyNames.Id]); // Table Test Assert.IsNotNull(page.MyTable); }
public void RefreshesCorrectWindowScope() { Driver.Click(Link("Open pop up window")); var popUp = new BrowserWindow(DefaultSessionConfiguration, new WindowFinder(Driver,"Pop Up Window",Root,DefaultOptions), Driver, null, null, null, DisambiguationStrategy); try { RefreshCausesScopeToReload(popUp); } finally { Driver.ExecuteScript("return self.close();", popUp); } }
/// <summary> /// Run/evaluate JavaScript code in the DOM context. /// </summary> /// <param name="browserWindow">The browser window.</param> /// <param name="code">The JavaScript code</param> public static void RunScript(BrowserWindow browserWindow, string code) { SHDocVw.InternetExplorer internetExplorer = null; ShellWindows shellWindows = new ShellWindows(); foreach (SHDocVw.InternetExplorer shellWindow in shellWindows) { if (shellWindow.HWND == browserWindow.WindowHandle.ToInt32()) { internetExplorer = shellWindow; break; } } internetExplorer.Document.parentWindow.execScript(code); }
/// <summary> /// On macOS, this displays a modal dialog that shows a message and certificate information, /// and gives the user the option of trusting/importing the certificate. If you provide a /// browserWindow argument the dialog will be attached to the parent window, making it modal. /// </summary> /// <param name="browserWindow"></param> /// <param name="options"></param> /// <returns></returns> public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options) { var taskCompletionSource = new TaskCompletionSource <object>(); BridgeConnector.Socket.On("showCertificateTrustDialogComplete", () => { BridgeConnector.Socket.Off("showCertificateTrustDialogComplete"); taskCompletionSource.SetResult(null); }); BridgeConnector.Socket.Emit("showCertificateTrustDialog", JObject.FromObject(browserWindow, _jsonSerializer), JObject.FromObject(options, _jsonSerializer)); return(taskCompletionSource.Task); }
protected override Task OnCreatedAsync(BrowserWindow window, CancellationToken ct) { _logger.Verbose("Registering OnBlur event handler"); window.OnBlur += () => { _logger.Debug("Shell is blured, hiding it"); window.Hide(); }; _logger.Verbose("Registering OnReadyToShow event handler"); window.OnReadyToShow += () => { _logger.Information("Shell is ready to be shown"); window.Show(); }; return(Task.CompletedTask); }
protected void OnTreeDoubleClick(Object sender, EventArgs e) { ManticoreTreeNode node = mBookmarksTree.SelectedNode as ManticoreTreeNode; Bookmarks bmks = ServiceManager.Bookmarks; String bookmarkURL = bmks.GetBookmarkAttribute(node.Data as String, "url"); if (bookmarkURL != "") { WindowMediator wm = ServiceManager.WindowMediator; BrowserWindow window = wm.GetMostRecentWindow("BrowserWindow") as BrowserWindow; if (window != null) { window.LoadURL(bookmarkURL); } } }
public void Click_ButtonInChildWindow_Succeeds() { BrowserWindow browserWindow = BrowserWindow.Launch(PageUrl); browserWindow.SetFocus(); SilverlightButton button = browserWindow.Find <SilverlightButton>(By.AutomationId("displayChildWindowButton")); button.Click(); SilverlightChildWindow childWindow = browserWindow.Find <SilverlightChildWindow>(By.AutomationId("TestChildWindow")); SilverlightButton okButton = childWindow.Find <SilverlightButton>(By.AutomationId("OKButton")); okButton.Click(); browserWindow.Close(); }
public void LoginTest() { //Retriving Data from Excel string UserName = TestContext.DataRow["UserName"].ToString(); string Password = TestContext.DataRow["Password"].ToString(); //create object for environment window = BrowserWindow.Launch(new Uri(_environment)); window.CloseOnPlaybackCleanup = false; //create object for page g = new HoneywellFirstLoginLogoff(window); //Call Login funtion g.Login(UserName, Password); }
public bool ShowLogin(object o) { if (o == null) throw new ArgumentException(Resources.InvalidLoginUrl); // URL shouldn't be empty. // URL can be empty, if user's local date is incorrect. // This a known bug, described here: https://github.com/DynamoDS/Dynamo/pull/6112 if ((o as string).Length == 0) { MessageBox.Show(Resources.InvalidTimeZoneMessage, Resources.InvalidLoginUrl, MessageBoxButton.OK, MessageBoxImage.Error); return false; } var url = new Uri(o.ToString()); var navigateSuccess = false; // show the login context.Send(_ => { var window = new BrowserWindow(url) { Title = Resources.AutodeskSignIn, Owner = parent, WindowStartupLocation = WindowStartupLocation.CenterOwner }; window.Browser.Navigated += (sender, args) => { // if the user reaches this path, they've successfully logged in // note that this is necessary, but not sufficient for full authentication if (args.Uri.LocalPath == "/OAuth/Allow") { navigateSuccess = true; window.Close(); } }; window.ShowDialog(); }, null); return navigateSuccess; }
private void Signup(string UserName, string Password, string Email) { BrowserWindow browser = BrowserWindow.FromProcess(proc); UITestControl uiSignUp = new UITestControl(browser); uiSignUp.TechnologyName = "Web"; uiSignUp.SearchProperties.Add("ControlType", "Hyperlink"); uiSignUp.SearchProperties.Add("TagName", "A"); Mouse.Click(uiSignUp); UITestControl uiUsername = new UITestControl(browser); uiUsername.TechnologyName = "Web"; uiUsername.SearchProperties.Add("ControlType", "Edit"); uiUsername.SearchProperties.Add("Id", "inputUsername"); uiUsername.SearchProperties.Add("Name", "user_username"); Keyboard.SendKeys(uiUsername, UserName); UITestControl uiEmail = new UITestControl(browser); uiEmail.TechnologyName = "Web"; uiEmail.SearchProperties.Add("ControlType", "Edit"); uiEmail.SearchProperties.Add("Id", "inputEmail"); uiEmail.SearchProperties.Add("Name", "user_email"); Keyboard.SendKeys(uiEmail, Email); UITestControl uiPassword1 = new UITestControl(browser); uiPassword1.TechnologyName = "Web"; uiPassword1.SearchProperties.Add("ControlType", "Edit"); uiPassword1.SearchProperties.Add("Id", "inputPassword"); Keyboard.SendKeys(uiPassword1, Password); UITestControl uiPassword2 = new UITestControl(browser); uiPassword2.TechnologyName = "Web"; uiPassword2.SearchProperties.Add("ControlType", "Edit"); uiPassword2.SearchProperties.Add("Id", "inputRePassword"); Keyboard.SendKeys(uiPassword2, Password); UITestControl uiSubmit = new UITestControl(browser); uiSubmit.TechnologyName = "Web"; uiSubmit.SearchProperties.Add("ControlType", "Button"); uiSubmit.SearchProperties.Add("Name", "submit"); Mouse.Click(uiSubmit); }
public static void Referal2eRegistration() { //Create BrowserWindow BrowserWindow Browind = new BrowserWindow(); //wait for control ready Browind.WaitForControlReady(1000); // Referral pane Browind.SearchProperties[UITestControl.PropertyNames.Name] = "Referrals"; //Progress Meter HtmlCustom progress = new HtmlCustom(Browind); progress.SearchProperties[HtmlCustom.PropertyNames.Id] = "progressmeter"; bool availabilty = (bool)progress.GetProperty(HtmlCustom.PropertyNames.Exists); string workflowEvent = PersonalInformation1.ReadData(1, "WORKFLOW"); if (workflowEvent == "S1PROSPECT") { Assert.IsTrue(availabilty, "Progress Meter is not showing"); HtmlSpan bar = new HtmlSpan(Browind); bar.SearchProperties[HtmlSpan.PropertyNames.Id] = "meterlabel"; string percentage = (string)bar.GetProperty(HtmlSpan.PropertyNames.InnerText); Assert.AreEqual(percentage, "60%"); } else { Assert.IsFalse(availabilty, "Progress Meter is showing"); } //Save And Continue button HtmlControl SaveCont = new HtmlControl(Browind); SaveCont.SearchProperties[HtmlButton.PropertyNames.Id] = "ForwardButton_button"; //Click button Save And Continue Assert.IsTrue(SaveCont.Enabled); Mouse.Click(SaveCont); Browind.WaitForControlReady(1000); }
public void FormLoginKH_SaiTenDangNhapHoacMatKhau() { Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.Disabled; Playback.PlaybackSettings.DelayBetweenActions = 500; Playback.PlaybackSettings.SearchTimeout = 10000; try { BrowserWindow browser = BrowserWindow.Launch("http://localhost:12742/"); browser.Maximized = true; browser.DrawHighlight(); UITestControl btnLogin = new UITestControl(browser); btnLogin.TechnologyName = "MSAA"; btnLogin.SearchProperties.Add("Name", "Đăng nhập"); btnLogin.SearchProperties.Add("ControlType", "Edit"); btnLogin.DrawHighlight(); Mouse.Click(btnLogin); UITestControl txtTen = new UITestControl(browser); txtTen.TechnologyName = "MSAA"; txtTen.SearchProperties.Add("Name", "Nhập tài khoản ..."); txtTen.SearchProperties.Add("ControlType", "Edit"); txtTen.DrawHighlight(); Keyboard.SendKeys(txtTen, "admin"); UITestControl txtPass = new UITestControl(browser); txtPass.TechnologyName = "MSAA"; txtPass.SearchProperties.Add("Name", "Mật khẩu ..."); txtPass.SearchProperties.Add("ControlType", "Edit"); txtPass.DrawHighlight(); Keyboard.SendKeys(txtPass, "admin"); UITestControl btnDangNhap = new UITestControl(browser); btnDangNhap.TechnologyName = "MSAA"; btnDangNhap.SearchProperties.Add("Name", "Đăng nhập"); btnDangNhap.SearchProperties.Add("ControlType", "Button"); btnDangNhap.DrawHighlight(); Mouse.Click(btnDangNhap); Playback.Wait(1000); } catch (Exception e) { Assert.Fail(e.ToString()); } }
public void eReg_Segmented_Wyoming() { BrowserWindow Browind = BrowserWindow.Locate("Abacus Logon"); eRegLogin.Login2eRegistration(); WelcomePane.welcome_SaveNContinue(); PersonalInformation_CurrentAddress_ContactInformation.personalInformation(); PersonalInformation_PaycheckStub.paycheck_Stub(); AddressHistory.S1AddressHistory(); EmergencyContact.EmergencyContactInformation(); PersonalInformation_StateOfEmployee.stateOfEmployee(); Preferences.eReg_Preferences(); EducationHistory.eReg_EducationHistory(); WorkExperience.eReg_WorkExperiance(); //WorkExperienceExempt.workExperienceExmpt_SaveNContinue(); Browind.CloseOnPlaybackCleanup = false; }
public void OnNewWindowTrident(Object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e) { bool allowPopups = ServiceManager.Preferences.GetBoolPref("browser.allowpopups"); if (allowPopups) { BrowserWindow window = new BrowserWindow(); // window.ShouldLoadHomePage = false; window.WebBrowser.RealizeLayoutEngine(); window.Show(); e.ppDisp = window.WebBrowser.Trident; } else { e.cancel = true; } }
/// <summary> /// RecordedMethod3 - Use 'RecordedMethod3Params' to pass parameters into this method. /// </summary> public void RecordedMethod3() { #region Variable Declarations BrowserWindow uIHomePageMyASPNETApplWindow = this.UIHomePageMyASPNETApplWindow; HtmlHyperlink uIAboutHyperlink = this.UIHomePageMyASPNETApplWindow.UIHomePageMyASPNETApplDocument.UIAboutHyperlink; HtmlHyperlink uIContactHyperlink = this.UIHomePageMyASPNETApplWindow.UIAboutMyASPNETApplicaDocument.UIContactHyperlink; #endregion // Go to web page 'http://localhost:3339/' uIHomePageMyASPNETApplWindow.NavigateToUrl(new System.Uri(this.RecordedMethod3Params.UIHomePageMyASPNETApplWindowUrl)); // Click 'About' link Mouse.Click(uIAboutHyperlink, new Point(44, 29)); // Click 'Contact' link Mouse.Click(uIContactHyperlink, new Point(54, 27)); }
public void Mouse_click_will_succeed_because_recorded_filter_properties_includes_tag_instance_number() { var example2Path = Path.Combine(TestContext.TestDeploymentDir, "example2.htm"); var window = BrowserWindow.Launch(example2Path); var map = new RecordedUIMap(); map.UIItem2ad6de5575f1403fWindow.CopyFrom(window); var visibleLink = map.UIItem2ad6de5575f1403fWindow.UIItem2ad6de5575f1403fDocument.UIHelloHyperlink; visibleLink.Find(); visibleLink.DrawHighlight(); Mouse.Click(visibleLink); }
public void SlButtonAndEditAndDTP_ClickAndSetTextAndSelectedDateAsString_Succeeds() { BrowserWindow b = BrowserWindow.Launch(PageUrl); b.SetFocus(); SilverlightButton button1 = b.Find <SilverlightButton>(By.AutomationId("button1")); button1.WaitForControlExist(); button1.Click(); SilverlightEdit oEdit = b.Find <SilverlightEdit>(By.AutomationId("textBox1")); oEdit.Text = "asddasdasdasdadasdadasdadadadasd"; SilverlightDatePicker dp = b.Find <SilverlightDatePicker>(By.AutomationId("datePicker1")); dp.SourceControl.SelectedDate = new DateTime(2011, 5, 11); b.Close(); }
/// <summary> /// Dialog for save files. /// </summary> /// <param name="browserWindow">The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.</param> /// <param name="options"></param> /// <returns>Returns String, the path of the file chosen by the user, if a callback is provided it returns an empty string.</returns> public Task <string> ShowSaveDialogAsync(BrowserWindow browserWindow, SaveDialogOptions options) { var taskCompletionSource = new TaskCompletionSource <string>(); BridgeConnector.Socket.On("showSaveDialogComplete", (filename) => { BridgeConnector.Socket.Off("showSaveDialogComplete"); taskCompletionSource.SetResult(filename.ToString()); }); BridgeConnector.Socket.Emit("showSaveDialog", JObject.FromObject(browserWindow, _jsonSerializer), JObject.FromObject(options, _jsonSerializer)); return(taskCompletionSource.Task); }
public void HeaderElementsUITest() { TestMethods test = new TestMethods(); var broswer = BrowserWindow.Launch("http://localhost:31419/Thunderstruck.html"); test.EnterText(broswer, "username", "Test"); test.EnterText(broswer, "password", "Test"); test.ClickButton(broswer, "loginBtn"); test.ClickLabel(broswer, "dashboard"); test.ClickLabel(broswer, "incidents"); test.ClickLabel(broswer, "editProfile"); test.ClickLabel(broswer, "switchRole"); test.ClickButton(broswer, "okBtn"); test.ClickLabel(broswer, "logoutBtn"); test.ClickButton(broswer, "loginBtn"); // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. }
private static TPage CreatePage <TPage, TMap, TValidator>(Process browserProcess) where TPage : BasePage <TMap, TValidator> where TMap : BaseMap where TValidator : BaseValidator <TMap> { var window = BrowserWindow.FromProcess(browserProcess); window.Maximized = true; var map = Activator.CreateInstance(typeof(TMap), window) as TMap; var validator = Activator.CreateInstance <TValidator>(); var page = Activator.CreateInstance <TPage>(); validator.Map = map; page.Map = map; page.Validator = validator; return(page); }
private async Task <BrowserWindow> CreateMainBrowserWindow() { //This must be registered before window creation ((IWebViewIdentity)(this)).OnBlazorAppLaunched += ElectronBlazorWebView_OnBlazorAppLaunched; if (ContextHelper.IsUsingWASM()) { //If using WASM, we must inherit from the BlazorMobile URI behavior _browserWindow = await Electron.WindowManager.CreateWindowAsync(Forms.GetDefaultBrowserWindowOptions(), WebApplicationFactory.GetBaseURL()); } else { _browserWindow = await Electron.WindowManager.CreateWindowAsync(Forms.GetDefaultBrowserWindowOptions()); } return(_browserWindow); }
public void Finds_scope_first_for_confirms() { using (Driver) { Driver.Click(Link("Open pop up window")); var popUp = new BrowserWindow(DefaultSessionConfiguration, new WindowFinder(Driver, "Pop Up Window", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); Assert.That(Driver.Title(popUp), Is.EqualTo("Pop Up Window")); Driver.ExecuteScript("window.setTimeout(function() {document.getElementById('confirmTriggerLink').click();},500);", Root); Assert.That(Driver.Title(popUp), Is.EqualTo("Pop Up Window")); CloseWindow(popUp); System.Threading.Thread.Sleep(500); Driver.CancelModalDialog(Root); Driver.HasDialog("You have triggered a confirm and this is the text.", Root).should_be_false(); } }
internal void SwitchToWindow(BrowserWindow window) { PauseWebElementExplorerProcessing(); view.DisableSwitchToControls(); try { SwdBrowser.GotoWindow(window); MyLog.Write("WINDOW: Switched to window/popup with WinID= " + window.WindowHandle + "; and Title:" + window.Title); RefreshFramesList(); } finally { ResumeWebElementExplorerProcessing(); view.EnableSwitchToControls(); } }
public void Ready() { // Write a message to the Console Console.WriteLine("Welcome to Bridge.NET"); WebPreferences wp = new WebPreferences() { sandbox = true, contextIsolation = true, nodeIntegration = false }; if (USE_SPIDER) { wp.preload = @"bin\Debug\bridge\spider.js"; } MainWindow = new BrowserWindow(new BrowserWindowConstructorOptions() { width = 1280, height = 600, title = "JsTracer", skipTaskbar = false, webPreferences = wp }); MainWindow.webContents.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36"); //$NOTE: don't enable this, or it will detach debugger from our end /*if (!MainWindow.webContents.isDevToolsOpened()) { * MainWindow.webContents.openDevTools(); * }*/ MainWindow.webContents.once(lit.did_start_loading, () => { //$TODO: Do we need to clear scripts/breakpoints when changing page? scripts.Clear(); Debug(); }); MainWindow.loadURL(PAGE_URL); MainWindow.webContents.on(lit.crashed, (ev, input) => { throw new Exception(ev.ToString()); }); }
public void BrowserWindowTest_Maximized() { BrowserWindow.NavigateToUrl(_basicTestPageUrl); BrowserWindow.Maximized = true; BrowserWindow.Width.Should().NotBe(BrowserWindow.DefaultWidth); BrowserWindow.Height.Should().NotBe(BrowserWindow.DefaultHeight); BrowserWindow.Maximized.Should().BeTrue(); BrowserWindow.Maximized = false; BrowserWindow.Width.Should().Be(BrowserWindow.DefaultWidth); BrowserWindow.Height.Should().Be(BrowserWindow.Height); BrowserWindow.Maximized.Should().BeFalse(); }
/// <summary> /// Runs troubleshooter in minimalistic mode. Finds first patch which can identify /// problem using fast identify method and asks user if he wants to repair problem. /// If problem was successfully repaired, application exits with exitcode 0. /// If problem wasnt repaired .. exit with code 1 /// </summary> public bool Run() { StringBuilder sb = new StringBuilder(); //find patch which identifies problem foreach (Patch p in TroubleShooter.Current.Patches) { if (p.FastIdentifySafe()) { sb.AppendLine(TroubleShooter.Current.RunData.ErrorMessage); sb.AppendLine(); sb.AppendLine("Troubleshooter sa pokúsi opraviť chybu automaticky. " + p.Description); sb.AppendLine(); sb.AppendLine("Prajete si vykonať automatickú opravu chyby?"); MessageBoxResult res = MessageBox.Show(sb.ToString(), "Chyba rogramu", MessageBoxButton.YesNo, MessageBoxImage.Error); sb.Clear(); if (res == MessageBoxResult.Yes) { if (p.SolveProblemSafe()) { sb.AppendLine("Automatická prava problému prebehla úspešne."); MessageBox.Show(sb.ToString(), "Oprava chyby", MessageBoxButton.OK, MessageBoxImage.Information); return(true); } else if (p.Instruction != null) { sb.AppendLine("Problém sa nepodarilo opraviť automaticky. K dispozícii je návod na jeho odstránenie. Prajete si ho zobraziť?"); if (MessageBox.Show(sb.ToString(), "Chyba programu", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes) { BrowserWindow browser = new BrowserWindow(new PatchResultVM(p)); browser.ShowDialog(); if (browser.Success) { MessageBox.Show("Problém bol úspešne odstránený.", "Chyba rogramu", MessageBoxButton.OK, MessageBoxImage.Information); return(true); } } } } MessageBox.Show("Problém sa nepodarilo odstrániť.", "Chyba rogramu", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } } return(false); }
public void ResizesCorrectWindowScope() { using (Driver) { Driver.Click(Link("Open pop up window")); var popUp = new BrowserWindow(DefaultSessionConfiguration, new WindowFinder(Driver, "Pop Up Window", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); try { AssertResizesWindow(popUp); } finally { Driver.ExecuteScript("return self.close();", popUp); } } }
private void CreateInstance_Click(object sender, RoutedEventArgs e) { var window = new BrowserWindow { Width = 600, Height = 600 }; window.Closing += WindowOnClosing; _browserWindows.Add(window); window.Visibility = Visibility.Hidden; window.Show(); var tab = window.Instance.ActiveTab as TabVm; tab.WaitBrowserLoaded(); window.Instance.SetUserAgent("Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fi-fi) AppleWebKit/420+ (KHTML, like Gecko) Safari/419.3"); }
public void ExceptionThrownWhenNoPopupExists() { string currentHandle = driver.CurrentWindowHandle; try { _ = new BrowserWindow(driver); Assert.Fail("Expected exception not thrown"); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch #pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body { } finally { QuitExtraDrivers(currentHandle); } }
/// <summary> /// Note: On Windows and Linux an open dialog can not be both a file selector /// and a directory selector, so if you set properties to ['openFile', 'openDirectory'] /// on these platforms, a directory selector will be shown. /// </summary> /// <param name="browserWindow"></param> /// <param name="options"></param> /// <returns>An array of file paths chosen by the user</returns> public Task <string[]> ShowOpenDialogAsync(BrowserWindow browserWindow, OpenDialogOptions options) { var taskCompletionSource = new TaskCompletionSource <string[]>(); BridgeConnector.Socket.On("showOpenDialogComplete", (filePaths) => { BridgeConnector.Socket.Off("showOpenDialogComplete"); var result = ((JArray)filePaths).ToObject <string[]>(); taskCompletionSource.SetResult(result); }); BridgeConnector.Socket.Emit("showOpenDialog", JObject.FromObject(browserWindow, _jsonSerializer), JObject.FromObject(options, _jsonSerializer)); return(taskCompletionSource.Task); }
public ExtendedWebBrowser New(bool navigateHome, string title = null) { BrowserWindow browserWindow = new BrowserWindow { IeHost = { Visibility = Visibility.Visible }, Title = title, Width = 800.0, Height = 600.0, WindowState = WindowState.Normal, WindowStartupLocation = WindowStartupLocation.CenterScreen }; browserWindow.Show(); return(browserWindow.IeWeb); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("calc_by"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomLink("n!").Click(); browserWindow.DomLink("btn_5").Click(); browserWindow.DomLink(")").Click(); browserWindow.DomLink("+").Click(); browserWindow.DomLink("btn_3").Click(); browserWindow.DomLink("btn_plus").Click(); browserWindow.DomLink("btn_3").Click(); browserWindow.DomLink("btn_minus").Click(); browserWindow.DomLink("btn_5").Click(); browserWindow.DomLink("btn_enter").Click(); Assert.AreEqual("124", browserWindow.DomTextField("calc_display_input").Text); }
async Task <int> CreateWindow(string __dirname) { // Create the browser window. mainWindow = await BrowserWindow.Create(new BrowserWindowOptions() { Width = 600, Height = 400 }); // and load the index.html of the app. await mainWindow.LoadURL($"file://{__dirname}/index.html"); // Open the DevTools //await mainWindow.GetWebContents().ContinueWith( // (t) => { t.Result?.OpenDevTools(DevToolsMode.Bottom); } //); return(await mainWindow.GetId()); }
public void DoLogin(string name) { username = username.Trim(); var url = flow.GetAuthorizeUrl(username); BrowserWindow bw = new BrowserWindow(url); //bw.Owner = this; if (bw.ShowDialog() == true) { if (!string.IsNullOrWhiteSpace(bw.Token)) { OAuthData.token = bw.Token; } this.token = bw.Token; this._appUser.IsAuthenticated = true; this._appUser.UserName = username; } }
private void OnTileImageDrawn() { if (_logPerformance) { if (HasCapture) { // Log the speed when stacking/window-leveling if (_fpsPublisher == null) { _fpsPublisher = new DelayedEventPublisher <EventArgs>((s, ev) => { PerformanceMonitor p = PerformanceMonitor. CurrentInstance; double fps = p.AverageClientFps; _eventMediator.PublishPerformance(new PerformanceData { ClientIp = ApplicationContext . Current . Parameters . LocalIPAddress, Name = "CLIENT_STACKING_SPEED", Value = fps }); BrowserWindow.SetStatus( String.Format( "Stacking Speed: {0:0} fps", fps)); }, 1000); } _fpsPublisher.Publish(this, EventArgs.Empty); } } }
private static void SavesToSpecifiedLocation(BrowserWindow browserWindow) { const string fileName = "screenshot-test-card.jpg"; try { browserWindow.SaveScreenshot(fileName, ImageFormat.Jpeg); Assert.That(File.Exists(fileName), "Expected screenshot saved to " + new FileInfo(fileName).FullName); using (var saved = Image.FromFile("screenshot-test-card.jpg")) { var docWidth = float.Parse(browserWindow.ExecuteScript("return window.document.body.clientWidth;")); var docHeight = float.Parse(browserWindow.ExecuteScript("return window.document.body.clientHeight;")); Assert.That(saved.PhysicalDimension, Is.EqualTo(new SizeF(docWidth, docHeight))); } } finally { if (File.Exists(fileName)) File.Delete(fileName); } }
public WorkOrderPage(BrowserWindow b) { b.CloseOnPlaybackCleanup = false; _browser = b; _workorderTab = new xHtmlHyperlink(b, "Work Orders", "InnerText"); _workorderPage = new xHtmlDiv(b, "New Work Orders ", "InnerText"); _newWorkorder = new xHtmlImage(b, "btnSubmitNewWO"); _name = new xHtmlEdit(b, "WorkOrderName"); _selectService = new xHtmlSpan(b, "k-icon k-i-arrow-s", "Class"); _HomeTab = new xHtmlHyperlink(b, "Home", "InnerText"); _createbtn = new xHtmlInputButton(b, "btnCreate"); _backbtn = new xHtmlImage(b, "btnBack"); _serialNo = new xHtmlEdit(b, "SerialNo"); _serchIcon = new xHtmlImage(b, "btnGo"); _Addbtn = new xHtmlInputButton(b, "btnAdd"); _successmsg = new xHtmlDiv(b, "success", "Class"); _errormsgName = new xHtmlSpan(b, "WorkOrderName_validationMessage"); _workOrderNameFilterLink = new xHtmlHyperlink(b, "14", "TagInstance"); _Filtertxt = new xHtmlEdit(b, "SINGLELINE","Type"); _filterbtn = new xHtmlButton(b, "Filter","DisplayText"); _clearbtn = new xHtmlButton(b, "reset", "Type"); _workOrderName = new xHtmlTableCell(b, "1", "TagInstance"); _nameMadatory = new xHtmlDiv(b, "Name*", "FriendlyName"); _SPMadatory = new xHtmlDiv(b, "Service Provider*", "FriendlyName"); _msgAutoSave = new xHtmlDiv(b, "SaveMessage"); _workStatus = new xHtmlTableCell(b, "6", "TagInstance"); _serialNoLink = new xHtmlHyperlink(b, "21", "TagInstance"); _verifySerialNo = new xHtmlTableCell(b, "3", "TagInstance"); _verifyAlertText = new xHtmlDiv(b, "AlertText"); _Okbtn = new xHtmlInputButton(b, "Ok", "DisplayText"); _productName = new xHtmlEdit(b, "ProductName"); _ItemNotFoundWin = new xHtmlDiv(b, "ItemNotFoundwindow"); _canclebtn = new xHtmlInputButton(b, "Cancel", "DisplayText"); _deletebtn = new xHtmlImage(b,"imgTrash"); _selectItem = new xHtmlCheckBox(b, "16", "TagInstance"); _deleteWin = new xHtmlDiv(b, "DeleteConfirmationWnd"); _yesbtn = new xHtmlInputButton(b, "Yes", "DisplayText"); _nobtn = new xHtmlInputButton(b, "No", "DisplayText"); }
public void Go_back_and_forward_in_correct_window_scope() { using (Driver) { Driver.Click(Link("Open pop up window")); var popUp = new BrowserWindow(DefaultSessionConfiguration, new WindowFinder(Driver, "Pop Up Window", Root, DefaultOptions), Driver, null, null, null, DisambiguationStrategy); Driver.Visit(TestSiteUrl("/auto_login"), Root); Driver.Visit(TestSiteUrl("/"), popUp); Driver.GoBack(popUp); Assert.That(Driver.Location(popUp).AbsoluteUri, Is.StringEnding("src/Coypu.Drivers.Tests/html/popup.htm")); Assert.That(Driver.Location(Root).AbsoluteUri, Is.EqualTo(TestSiteUrl("/auto_login"))); Driver.GoForward(popUp); Assert.That(Driver.Location(popUp).AbsoluteUri, Is.EqualTo(TestSiteUrl("/"))); Driver.GoBack(Root); Assert.That(Driver.Location(Root).AbsoluteUri, Is.StringEnding("/html/InteractionTestsPage.htm")); Assert.That(Driver.Location(popUp).AbsoluteUri, Is.EqualTo(TestSiteUrl("/"))); } }
private void CheckValidation(BrowserWindow browser) { var label = new HtmlLabel(); label.SearchProperties.Add(HtmlLabel.PropertyNames.InnerText, "Please enter positive number greater than 0"); }
public HomePage(BrowserWindow browserWindow) : base(browserWindow) { }
//public static RemoteWebDriver driver; public void NullifyWindow() { browser = null; }
/// <summary> /// Utilized to switch between browser windows /// Selenium plugin is required for Coded UI Cross-Browser compatibility /// </summary> /// <param name="browserClass">Defaults to Internet Explorer class and can /// additionally take in class names for Chrome, Firefox</param> /// <returns></returns> public static UITestControlCollection SwitchWindow(BrowserWindow b, string browserClass = "IEFrame") { b.SearchProperties[PropertyNames.ClassName] = browserClass; return b.FindMatchingControls(); }
/// <summary> /// Selects 'OK' for browser dialog popups /// </summary> /// <param name="b">Takes current browser</param> public static void AlertOk(BrowserWindow b) { b.PerformDialogAction(BrowserDialogAction.Ok); }
private void HandleWebBrowserNewWindow(string url, int flags, string targetFrameName, ref object postData, string headers, ref bool processed) { processed = true; var window = new BrowserWindow { DataContext = new NavigatorViewModel(), }; window.Show(); window.WebBrowser.Navigate(url); }
public BingMap(BrowserWindow window) : base(window) { }
private void ClickTryAgainHyperLink(BrowserWindow browser) { var hyperLink = new HtmlHyperlink(browser); hyperLink.SearchProperties.Add(HtmlHyperlink.PropertyNames.InnerText, "Try Again"); Mouse.Click(hyperLink); }