public WaitWrapper Select() { Exists().ShouldBeTrue(); Enabled().ShouldBeTrue(); _radioButton.Click(); return(new WaitWrapper()); }
public void In_SelectFacility_Select_SystemAdminRadioButton(Window window) { RadioButton systemAdminRadioButton = window.Get <RadioButton>(SearchCriteria.ByAutomationId("systemAdminRadioButton")); systemAdminRadioButton.Click(); Assert.IsTrue(systemAdminRadioButton.IsSelected); }
public void In_SelectFacility_Select_FacilityRadioButton(Window window) { RadioButton facilityRadioButton = window.Get <RadioButton>(SearchCriteria.ByAutomationId("facilityRadioButton")); facilityRadioButton.Click(); Assert.IsTrue(facilityRadioButton.IsSelected); }
void ClickOnItem(int index) { Log.Comment("Clicking on item 'Radio Button " + index + "'"); RadioButton item = FindElement.ByName <RadioButton>("Radio Button " + index); item.Click(); }
private void SetInfo(int amountOfSymbols) { AmountOfSymbols.Click(); AmountOfSymbols.Clear(); AmountOfSymbols.SendKeys(amountOfSymbols.ToString()); RadioButton.Click(); }
public void FillEmailForm(PracticeRegistrationModel user) { SignInButton.Click(); EmailAddressField.SendKeys(user.EmailAddressField); CreateAccountButton.Click(); RadioButton.Click(); FirstName.SendKeys(user.FirstName); LastName.SendKeys(user.LastName); Password.SendKeys(user.Password); SelectElement date = new SelectElement(Date); date.SelectByValue("1"); SelectElement month = new SelectElement(Month); month.SelectByValue("2"); SelectElement year = new SelectElement(Year); year.SelectByValue("2010"); Address.SendKeys(user.Address); City.SendKeys(user.City); SelectElement state = new SelectElement(State); state.SelectByValue("2"); ZipCode.SendKeys(user.ZipCode); MobilePhone.SendKeys(user.MobilePhone); RegisterButton.Click(); }
static void Main(string[] args) { //Extract MSI File var commandLine = @"D:\WORK AREA\M2 Test Automation\Trials\Build 3.0.0.14\Config\setup.exe"; var parameters = @"/s /x /b""setupfiles"" /v"" /qn"""; Process.Start(commandLine, parameters); //Launch the installer Thread.Sleep(TimeSpan.FromSeconds(5)); var appPath = System.IO.Directory.GetCurrentDirectory() + @"\setupfiles\CareFusion - Alaris System Tracking Application Configuration v3.0.msi"; Application app = Application.Launch(appPath); //Get Window and click Next Thread.Sleep(TimeSpan.FromSeconds(5)); Window mainWindow = app.GetWindow("CareFusion - Alaris System Tracking Application Configuration v3.0"); Thread.Sleep(TimeSpan.FromSeconds(15)); mainWindow = app.GetWindow("CareFusion - Alaris System Tracking Application Configuration v3.0"); Button NextButton = mainWindow.Get <Button>(SearchCriteria.ByAutomationId("2495")); NextButton.Click(); //Select Existing SQL instance and click Next Thread.Sleep(TimeSpan.FromSeconds(2)); mainWindow = app.GetWindow("CareFusion - Alaris System Tracking Application Configuration v3.0 - InstallShield Wizard"); Thread.Sleep(TimeSpan.FromSeconds(2)); RadioButton ExistingDBRadioButton = mainWindow.Get <RadioButton>(SearchCriteria.ByAutomationId("2602")); ExistingDBRadioButton.Click(); NextButton = mainWindow.Get <Button>(SearchCriteria.ByText("Next >")); NextButton.Click(); //Browser for local SQL instance Thread.Sleep(TimeSpan.FromSeconds(2)); mainWindow = app.GetWindow("CareFusion - Alaris System Tracking Application Configuration v3.0"); Button BrowseButton = mainWindow.Get <Button>(SearchCriteria.ByAutomationId("2613")); BrowseButton.Click(); Window serverWindow = mainWindow.ModalWindow("CareFusion - Alaris System Tracking Application Configuration v3.0"); ListBox list = serverWindow.Get <ListBox>(SearchCriteria.ByAutomationId("4014")); ListItem server = list.Item("(local)"); server.Click(); //Button nextButton = (Button)mainWindow.Get(sc); //nextButton.Click(); }
public void Click() { Service.BrowserActions.Refresh(); RadioButton Element = Service.LocateWebElement.LocateElementByXPath(eElementType.RadioButton, "//*[@id=\"test18\"]/input[2]") as RadioButton; Element.Click(); object result = Service.BrowserActions.ExecuteScript("document.getElementsByName(\"country\")[1].checked"); RadioButton Element2 = Service.LocateWebElement.LocateElementByXPath(eElementType.RadioButton, "//*[@id=\"test18\"]/input[2]") as RadioButton; Assert.AreEqual("true", Element2.GetAttribute("checked")); }
void TapOnItem(int index, bool useBackup = false) { if (useBackup) { BackupTap(index); } else { Log.Comment("Clicking on item 'Radio Button " + index + "'"); RadioButton item = FindElement.ByName <RadioButton>("Radio Button " + index); item.Click(); } }
public void ClickRadioButton(SearchCriteria criteria, Window window) { logger.LogInfo($"Searching for radiobutton with criteria {criteria}"); RadioButton radioButton = window.Get <RadioButton>(criteria); logger.LogInfo($"Button found {radioButton.Name} in {window.Title}"); if (WaitHelpers.WaitForEnabled(radioButton, TimeSpan.FromMinutes(5))) { logger.LogInfo($"Clicking {radioButton.Name}"); radioButton.Click(); } }
public void SelectNo() { Log.Info("Selecting keep existing users"); noButton.Click(); try { noRadioButton.WaitForSelected(5000); } catch (Exception) { Log.Info("Radiobutton is not ready"); noRadioButton.Click(); } }
void HandleDrawToolChangedEvent(object sender, EventArgs e) { RadioButton button = buttonToDrawTool.GetKeyByValue(blackboard.Tool); if (blackboard.Tool != DrawTool.Selection) { selectedDrawable = null; blackboard.ClearSelection(); } if (!button.Active) { button.Click(); } }
public void Save(string widgetName, string[] hierarchyNamePath, bool isCreateDashboard, string dashboardName) { WidgetNameTextbox.Fill(widgetName); TimeManager.MediumPause(); if (hierarchyNamePath != null) { WidgetSaveHierarchy.Click(); TimeManager.MediumPause(); WidgetSaveHierarchyTree.SelectNode(hierarchyNamePath); TimeManager.MediumPause(); } TimeManager.LongPause(); if (isCreateDashboard) { CreateDashboardButton.Click(); TimeManager.MediumPause(); DashboardNameTextbox.Fill(dashboardName); TimeManager.MediumPause(); } else { DashboardComboBox.SelectItem(dashboardName); } base.Confirm(); //store the dashboards infos prepare to delete when complete running. DashboardInformation CaseDownDashboardInfo = new DashboardInformation(); CaseDownDashboardInfo.DashboardName = dashboardName; CaseDownDashboardInfo.IsCreateDashboard = isCreateDashboard; CaseDownDashboardInfo.WigetName = widgetName; CaseDownDashboardInfo.HierarchyName = hierarchyNamePath; TestAssemblyInitializer.CaseDownDashboardInfos.Add(CaseDownDashboardInfo); }
public void FillForm(RegistrationUser user) { RadioButton.Click(); FirstName.SendKeys(user.FirstName); LastName.SendKeys(user.LastName); Email.Clear(); Email.SendKeys(user.Email); Password.SendKeys(user.Password); DaysOption.SelectByIndex(user.DateOfBirth.Day); MonthsOption.SelectByIndex(user.DateOfBirth.Month); YearsOption.SelectByValue(user.DateOfBirth.Year.ToString()); SignUpNewsletter.Click(); Address_FirstName.SendKeys(user.Address.FirstName); Address_LastName.SendKeys(user.Address.LastName); Address_Address1.SendKeys(user.Address.Address1); Address_City.SendKeys(user.Address.City); StateOption.SelectByText(user.Address.State); Address_ZipCode.SendKeys(user.Address.ZipCode.ToString()); CountryOption.SelectByText(user.Address.Country); Address_Info.SendKeys(user.Address.Info); Address_MobPhone.SendKeys(user.Address.MobPhone); RegisterButton.Click(); }
public void TestMethod1() { Application application = null; Window window = null; application = Application.Launch(@"F:\Navaneethapperumal\Works\WPF\Automation\SimpleCalculator\SimpleCalculator\bin\Debug\SimpleCalculator.exe"); var windows = application.GetWindows(); // window = windows[0]; window = windows.Find(x => x.Title == "MainWindow"); TextBox firstNumber = window.Get <TextBox>(SearchCriteria.ByAutomationId("firstNumber")); Thread.Sleep(3000); firstNumber.SetValue("4"); TextBox secondNumber = window.Get <TextBox>(SearchCriteria.ByAutomationId("secondNumber")); secondNumber.SetValue("6"); Thread.Sleep(3000); Button calculateBtn = window.Get <Button>(SearchCriteria.ByAutomationId("calculateButton")); calculateBtn.Click(); Thread.Sleep(3000); TextBox resultValue = window.Get <TextBox>(SearchCriteria.ByAutomationId("resultTxtBox")); Assert.IsTrue(Convert.ToDouble(resultValue.Text) == 10); RadioButton subtraction = window.Get <RadioButton>(SearchCriteria.ByAutomationId("subRadioButton")); subtraction.Click(); Thread.Sleep(1000); calculateBtn.Click(); Assert.IsTrue(Convert.ToDouble(resultValue.Text) == -2); Thread.Sleep(3000); application.Close(); }
public void PurchaseRocketWithLogs() { // 2. In the testFrameworkSettings.json file find a section called logging, responsible for controlling the BDD logs generation. // "loggingSettings": { // "isEnabled": "true", // "isConsoleLoggingEnabled": "true", // "isDebugLoggingEnabled": "true", // "isEventLoggingEnabled": "false", // "isFileLoggingEnabled": "true", // "outputTemplate": "{Message:lj}{NewLine}", // "addUrlToBddLogging": "false" // } // // You can disable the logs entirely. There are different places where the logs are populated. // By default, you can see the logs in the output window of each test. // Also, a file called logs.txt is generated in the folder with the DLLs of your tests. // If you execute your tests in CI with some CLI test runner the logs are printed there as well. // outputTemplate - controls how the message is formatted. You can add additional info such as timestamp and much more. // for more info visit- https://github.com/serilog/serilog/wiki/Formatting-Output // If addUrlToBddLogging is true, after each action the current page's URL will be added. App.NavigationService.Navigate("http://demos.bellatrix.solutions/"); // 3. As mentioned before BELLATRIX searches for elements not immediately but after you perform an action or assert. // This is why we can place all elements and later perform actions on them. It is possible at the moment of declaring them, // not to be yet present on the page. // Home page elements Select sortDropDown = App.ElementCreateService.CreateByNameEndingWith <Select>("orderby"); Anchor protonMReadMoreButton = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Read more"); Anchor addToCartFalcon9 = App.ElementCreateService.CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable(); Anchor viewCartButton = App.ElementCreateService.CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable(); // Home Page actions sortDropDown.SelectByText("Sort by price: low to high"); protonMReadMoreButton.Hover(); addToCartFalcon9.Focus(); addToCartFalcon9.Click(); viewCartButton.Click(); // Cart page elements TextField couponCodeTextField = App.ElementCreateService.CreateById <TextField>("coupon_code"); Button applyCouponButton = App.ElementCreateService.CreateByValueContaining <Button>("Apply coupon"); Div messageAlert = App.ElementCreateService.CreateByClassContaining <Div>("woocommerce-message"); Number quantityBox = App.ElementCreateService.CreateByClassContaining <Number>("input-text qty text"); Button updateCart = App.ElementCreateService.CreateByValueContaining <Button>("Update cart").ToBeClickable(); Span totalSpan = App.ElementCreateService.CreateByXpath <Span>("//*[@class='order-total']//span"); Anchor proceedToCheckout = App.ElementCreateService.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward"); // Cart page actions couponCodeTextField.SetText("happybirthday"); applyCouponButton.Click(); messageAlert.ToHasContent().ToBeVisible().WaitToBe(); messageAlert.ValidateInnerTextIs("Coupon code applied successfully."); App.BrowserService.WaitForAjax(); quantityBox.SetNumber(2); updateCart.Click(); App.BrowserService.WaitForAjax(); totalSpan.ValidateInnerTextIs("114.00€", 15000); proceedToCheckout.Click(); // Checkout page elements Heading billingDetailsHeading = App.ElementCreateService.CreateByInnerTextContaining <Heading>("Billing details"); Anchor showLogin = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Click here to login"); TextArea orderCommentsTextArea = App.ElementCreateService.CreateById <TextArea>("order_comments"); TextField billingFirstName = App.ElementCreateService.CreateById <TextField>("billing_first_name"); TextField billingLastName = App.ElementCreateService.CreateById <TextField>("billing_last_name"); TextField billingCompany = App.ElementCreateService.CreateById <TextField>("billing_company"); Select billingCountry = App.ElementCreateService.CreateById <Select>("billing_country"); TextField billingAddress1 = App.ElementCreateService.CreateById <TextField>("billing_address_1"); TextField billingAddress2 = App.ElementCreateService.CreateById <TextField>("billing_address_2"); TextField billingCity = App.ElementCreateService.CreateById <TextField>("billing_city"); Select billingState = App.ElementCreateService.CreateById <Select>("billing_state").ToBeVisible().ToBeClickable(); TextField billingZip = App.ElementCreateService.CreateById <TextField>("billing_postcode"); Phone billingPhone = App.ElementCreateService.CreateById <Phone>("billing_phone"); Email billingEmail = App.ElementCreateService.CreateById <Email>("billing_email"); CheckBox createAccountCheckBox = App.ElementCreateService.CreateById <CheckBox>("createaccount"); RadioButton checkPaymentsRadioButton = App.ElementCreateService.CreateByAttributesContaining <RadioButton>("for", "payment_method_cheque"); // Checkout page actions billingDetailsHeading.ToBeVisible().WaitToBe(); showLogin.ValidateHrefIs("http://demos.bellatrix.solutions/checkout/#"); showLogin.ValidateCssClassIs("showlogin"); orderCommentsTextArea.ScrollToVisible(); orderCommentsTextArea.SetText("Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean..."); billingFirstName.SetText("In"); billingLastName.SetText("Deepthought"); billingCompany.SetText("Automate The Planet Ltd."); billingCountry.SelectByText("Bulgaria"); billingAddress1.ValidatePlaceholderIs("House number and street name"); billingAddress1.SetText("bul. Yerusalim 5"); billingAddress2.SetText("bul. Yerusalim 6"); billingCity.SetText("Sofia"); billingState.SelectByText("Sofia-Grad"); billingZip.SetText("1000"); billingPhone.SetPhone("+00359894646464"); billingEmail.SetEmail("*****@*****.**"); createAccountCheckBox.Check(); checkPaymentsRadioButton.Click(); // 4. After the test is executed the following log is created: // // #### Start Chrome on PORT = 34079 // Start Test // Class = BDDLoggingTests Name = PurchaseRocketWithLogs // Select 'Sort by price: low to high' from control (Name ending with orderby) // Hover control (InnerText containing Read more) // Focus control (data-product_id = 28) // Click control (data-product_id = 28) // Click control (Class = added_to_cart wc-forward) // Type 'happybirthday' into control (ID = coupon_code) // Click control (Value containing Apply coupon) // Validate control (Class = woocommerce-message) inner text is 'Coupon code applied successfully.' // Set '0' into control (Class = input-text qty text) // Set '2' into control (Class = input-text qty text) // Click control (Value containing Update cart) // Validate control (XPath = //*[@class='order-total']//span) inner text is '95.00€' // Click control (Class = checkout-button button alt wc-forward) // Validate control (InnerText containing Click here to login) href is 'http://demos.bellatrix.solutions/checkout/#' // Validate control (InnerText containing Click here to login) CSS class is 'showlogin' // Scroll to visible control (ID = order_comments) // Type 'Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean...' into control (ID = order_comments) // Type 'In' into control (ID = billing_first_name) // Type 'Deepthought' into control (ID = billing_last_name) // Type 'Automate The Planet Ltd.' into control (ID = billing_company) // Select 'Bulgaria' from control (ID = billing_country) // Validate control (ID = billing_address_1) placeholder is 'House number and street name' // Type 'bul. Yerusalim 5' into control (ID = billing_address_1) // Type 'bul. Yerusalim 6' into control (ID = billing_address_2) // Type 'Sofia' into control (ID = billing_city) // Select 'Sofia-Grad' from control (ID = billing_state) // Type '1000' into control (ID = billing_postcode) // Type '+00359894646464' into control (ID = billing_phone) // Type '*****@*****.**' into control (ID = billing_email) // Check control (ID = createaccount) // Click control (for = payment_method_cheque) // 5. You can notice that since we use Validate assertions not the regular one they also present in the log: // Validate control (XPath = //*[@class='order-total']//span) inner text is '95.00€' // 6. There are two specifics about the generation of the logs. If page objects are used, which are discussed in next chapters. // Two things change. // 1. Instead of locators, the exact names of the element properties are printed. // 2. Instead of page URL, the name of the page is displayed. }
private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, HLE.FileSystem.Content.ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle) { Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png"); _parent = parent; builder.Autoconnect(this); _timeZoneContentManager = new TimeZoneContentManager(); _timeZoneContentManager.InitializeInstance(virtualFileSystem, contentManager, IntegrityCheckLevel.None); _validTzRegions = new HashSet <string>(_timeZoneContentManager.LocationNameCache.Length, StringComparer.Ordinal); // Zone regions are identifiers. Must match exactly. // Bind Events. _configureController1.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player1); _configureController2.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player2); _configureController3.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player3); _configureController4.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player4); _configureController5.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player5); _configureController6.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player6); _configureController7.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player7); _configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Player8); _configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, PlayerIndex.Handheld); _systemTimeZoneEntry.FocusOutEvent += TimeZoneEntry_FocusOut; _resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; _galThreading.Changed += (sender, args) => { if (_galThreading.ActiveId != ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString()) { GtkDialog.CreateInfoDialog("Warning - Backend Threading", "Ryujinx must be restarted after changing this option for it to apply fully. Depending on your platform, you may need to manually disable your driver's own multithreading when using Ryujinx's."); } }; // Setup Currents. if (ConfigurationState.Instance.Logger.EnableTrace) { _traceLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFileLog) { _fileLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableError) { _errorLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableWarn) { _warningLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableInfo) { _infoLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableStub) { _stubLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableDebug) { _debugLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableGuest) { _guestLogToggle.Click(); } if (ConfigurationState.Instance.Logger.EnableFsAccessLog) { _fsAccessLogToggle.Click(); } foreach (GraphicsDebugLevel level in Enum.GetValues <GraphicsDebugLevel>()) { _graphicsDebugLevel.Append(level.ToString(), level.ToString()); } _graphicsDebugLevel.SetActiveId(ConfigurationState.Instance.Logger.GraphicsDebugLevel.Value.ToString()); if (ConfigurationState.Instance.System.EnableDockedMode) { _dockedModeToggle.Click(); } if (ConfigurationState.Instance.EnableDiscordIntegration) { _discordToggle.Click(); } if (ConfigurationState.Instance.CheckUpdatesOnStart) { _checkUpdatesToggle.Click(); } if (ConfigurationState.Instance.ShowConfirmExit) { _showConfirmExitToggle.Click(); } if (ConfigurationState.Instance.HideCursorOnIdle) { _hideCursorOnIdleToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableVsync) { _vSyncToggle.Click(); } if (ConfigurationState.Instance.Graphics.EnableShaderCache) { _shaderCacheToggle.Click(); } if (ConfigurationState.Instance.System.EnablePtc) { _ptcToggle.Click(); } if (ConfigurationState.Instance.System.EnableInternetAccess) { _internetToggle.Click(); } if (ConfigurationState.Instance.System.EnableFsIntegrityChecks) { _fsicToggle.Click(); } switch (ConfigurationState.Instance.System.MemoryManagerMode.Value) { case MemoryManagerMode.SoftwarePageTable: _mmSoftware.Click(); break; case MemoryManagerMode.HostMapped: _mmHost.Click(); break; case MemoryManagerMode.HostMappedUnsafe: _mmHostUnsafe.Click(); break; } if (ConfigurationState.Instance.System.ExpandRam) { _expandRamToggle.Click(); } if (ConfigurationState.Instance.System.IgnoreMissingServices) { _ignoreToggle.Click(); } if (ConfigurationState.Instance.Hid.EnableKeyboard) { _directKeyboardAccess.Click(); } if (ConfigurationState.Instance.Hid.EnableMouse) { _directMouseAccess.Click(); } if (ConfigurationState.Instance.Ui.EnableCustomTheme) { _custThemeToggle.Click(); } // Custom EntryCompletion Columns. If added to glade, need to override more signals ListStore tzList = new ListStore(typeof(string), typeof(string), typeof(string)); _systemTimeZoneCompletion.Model = tzList; CellRendererText offsetCol = new CellRendererText(); CellRendererText abbrevCol = new CellRendererText(); _systemTimeZoneCompletion.PackStart(offsetCol, false); _systemTimeZoneCompletion.AddAttribute(offsetCol, "text", 0); _systemTimeZoneCompletion.TextColumn = 1; // Regions Column _systemTimeZoneCompletion.PackStart(abbrevCol, false); _systemTimeZoneCompletion.AddAttribute(abbrevCol, "text", 2); int maxLocationLength = 0; foreach (var(offset, location, abbr) in _timeZoneContentManager.ParseTzOffsets()) { var hours = Math.DivRem(offset, 3600, out int seconds); var minutes = Math.Abs(seconds) / 60; var abbr2 = (abbr.StartsWith('+') || abbr.StartsWith('-')) ? string.Empty : abbr; tzList.AppendValues($"UTC{hours:+0#;-0#;+00}:{minutes:D2} ", location, abbr2); _validTzRegions.Add(location); maxLocationLength = Math.Max(maxLocationLength, location.Length); } _systemTimeZoneEntry.WidthChars = Math.Max(20, maxLocationLength + 1); // Ensure minimum Entry width _systemTimeZoneEntry.Text = _timeZoneContentManager.SanityCheckDeviceLocationName(ConfigurationState.Instance.System.TimeZone); _systemTimeZoneCompletion.MatchFunc = TimeZoneMatchFunc; _systemLanguageSelect.SetActiveId(ConfigurationState.Instance.System.Language.Value.ToString()); _systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString()); _galThreading.SetActiveId(ConfigurationState.Instance.Graphics.BackendThreading.Value.ToString()); _resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString()); _custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath; _resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString(); _resScaleText.Visible = _resScaleCombo.ActiveId == "-1"; _graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath; _fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode; _systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset; _gameDirsBox.AppendColumn("", new CellRendererText(), "text", 0); _gameDirsBoxStore = new ListStore(typeof(string)); _gameDirsBox.Model = _gameDirsBoxStore; foreach (string gameDir in ConfigurationState.Instance.Ui.GameDirs.Value) { _gameDirsBoxStore.AppendValues(gameDir); } if (_custThemeToggle.Active == false) { _custThemePath.Sensitive = false; _custThemePathLabel.Sensitive = false; _browseThemePath.Sensitive = false; } //Setup system time spinners UpdateSystemTimeSpinners(); _audioBackendStore = new ListStore(typeof(string), typeof(AudioBackend)); TreeIter openAlIter = _audioBackendStore.AppendValues("OpenAL", AudioBackend.OpenAl); TreeIter soundIoIter = _audioBackendStore.AppendValues("SoundIO", AudioBackend.SoundIo); TreeIter sdl2Iter = _audioBackendStore.AppendValues("SDL2", AudioBackend.SDL2); TreeIter dummyIter = _audioBackendStore.AppendValues("Dummy", AudioBackend.Dummy); _audioBackendSelect = ComboBox.NewWithModelAndEntry(_audioBackendStore); _audioBackendSelect.EntryTextColumn = 0; _audioBackendSelect.Entry.IsEditable = false; switch (ConfigurationState.Instance.System.AudioBackend.Value) { case AudioBackend.OpenAl: _audioBackendSelect.SetActiveIter(openAlIter); break; case AudioBackend.SoundIo: _audioBackendSelect.SetActiveIter(soundIoIter); break; case AudioBackend.SDL2: _audioBackendSelect.SetActiveIter(sdl2Iter); break; case AudioBackend.Dummy: _audioBackendSelect.SetActiveIter(dummyIter); break; default: throw new ArgumentOutOfRangeException(); } _audioBackendBox.Add(_audioBackendSelect); _audioBackendSelect.Show(); _previousVolumeLevel = ConfigurationState.Instance.System.AudioVolume; _audioVolumeLabel = new Label("Volume: "); _audioVolumeSlider = new Scale(Orientation.Horizontal, 0, 100, 1); _audioVolumeLabel.MarginStart = 10; _audioVolumeSlider.ValuePos = PositionType.Right; _audioVolumeSlider.WidthRequest = 200; _audioVolumeSlider.Value = _previousVolumeLevel * 100; _audioVolumeSlider.ValueChanged += VolumeSlider_OnChange; _audioBackendBox.Add(_audioVolumeLabel); _audioBackendBox.Add(_audioVolumeSlider); _audioVolumeLabel.Show(); _audioVolumeSlider.Show(); bool openAlIsSupported = false; bool soundIoIsSupported = false; bool sdl2IsSupported = false; Task.Run(() => { openAlIsSupported = OpenALHardwareDeviceDriver.IsSupported; soundIoIsSupported = SoundIoHardwareDeviceDriver.IsSupported; sdl2IsSupported = SDL2HardwareDeviceDriver.IsSupported; }); // This function runs whenever the dropdown is opened _audioBackendSelect.SetCellDataFunc(_audioBackendSelect.Cells[0], (layout, cell, model, iter) => { cell.Sensitive = ((AudioBackend)_audioBackendStore.GetValue(iter, 1)) switch { AudioBackend.OpenAl => openAlIsSupported, AudioBackend.SoundIo => soundIoIsSupported, AudioBackend.SDL2 => sdl2IsSupported, AudioBackend.Dummy => true, _ => throw new ArgumentOutOfRangeException() }; });
/// <summary> /// Click Ascending button /// </summary> /// <param></param> /// <returns></returns> public void ClickAscendingCustomizedLabellingButton() { AscendingButton.Click(); }
public void PurchaseRocket() { App.NavigationService.Navigate("http://demos.bellatrix.solutions/"); // 2. Create methods accept a generic parameter the type of the web control. Then only the methods for this specific control are accessible. // Here we tell BELLATRIX to find your element by name attribute ending with 'orderby'. Select sortDropDown = App.ElementCreateService.CreateByNameEndingWith <Select>("orderby"); // 3. You can select from select inputs by text (SelectByText) or index (SelectByIndex)). // Also, you can get the selected option through GetSelected method. // <select name="orderby" class="orderby"> // <option value="popularity" selected="selected">Sort by popularity</option> // <option value="rating">Sort by average rating</option> // <option value="date">Sort by newness</option> // <option value="price">Sort by price: low to high</option> // <option value="price-desc">Sort by price: high to low</option> // </select> sortDropDown.SelectByText("Sort by price: low to high"); // 4. Here BELLATRIX finds the first anchor element which has inner text containing the 'Read more' text. // <a href='http://demos.bellatrix.solutions/product/proton-m/'>Read more</a> Anchor protonMReadMoreButton = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Read more"); // 5. You can Hover and Focus on most web elements. Also, can invoke Click on anchors. protonMReadMoreButton.Hover(); // 6. Locate elements by custom attribute. Also, bellow BELLATRIX waits till the anchor is clickable before doing any actions. // <a href="/?add-to-cart=28" data-product_id="28">Add to cart</a> Anchor addToCartFalcon9 = App.ElementCreateService .CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable(); addToCartFalcon9.Focus(); addToCartFalcon9.Click(); // 7. Find the anchor by class 'added_to_cart wc-forward' and wait for the element again to be clickable. // <a href="http://demos.bellatrix.solutions/cart/" class="added_to_cart wc-forward" title="View cart">View cart</a> Anchor viewCartButton = App.ElementCreateService .CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable(); viewCartButton.Click(); // 8. Find a regular input text element by id = 'coupon_code'. TextField couponCodeTextField = App.ElementCreateService.CreateById <TextField>("coupon_code"); // 9. Instead of using vanilla WebDriver SendKeys to set the text, use the SetText method. couponCodeTextField.SetText("happybirthday"); // 10. Create a button control by value attribute containing the text 'Apply coupon'. // <input type="submit" class="button" name="apply_coupon" value="Apply coupon"> // Button can be any of the following web elements- input button, input submit or button. Button applyCouponButton = App.ElementCreateService.CreateByValueContaining <Button>("Apply coupon"); applyCouponButton.Click(); Div messageAlert = App.ElementCreateService.CreateByClassContaining <Div>("woocommerce-message"); // 11. Wait for the message DIV to show up and have some content. // <div class="woocommerce-message" role="alert">Coupon code applied successfully.</div> messageAlert.ToHasContent().ToBeVisible().WaitToBe(); // 12. Sometimes you need to verify the content of some element. However, since the asynchronous nature of websites, // the text or event may not happen immediately. This makes the simple Assert methods + vanilla WebDriver useless. // The commented code fails 1 from 5 times. ////Assert.AreEqual("Coupon code applied successfully.", messageAlert.InnerText); // To handle these situations, BELLATRIX has hundreds of Validate methods that wait for some condition to happen before asserting. // Bellow the statement waits for the specific text to appear and assert it. // Note: There are much more details about these methods in the next chapters. messageAlert.ValidateInnerTextIs("Coupon code applied successfully."); // 13. Find the number element by class 'input-text qty text'. // <input type="number" id="quantity_5ad35e76b34a2" step="1" min="0" max="" value="1" size="4" pattern="[0-9]*" inputmode="numeric"> Number quantityBox = App.ElementCreateService.CreateByClassContaining <Number>("input-text qty text"); // 14. For numbers elements, you can set the number and get most of the properties of these elements. App.BrowserService.WaitUntilReady(); quantityBox.SetNumber(2); Button updateCart = App.ElementCreateService.CreateByValueContaining <Button>("Update cart") .ToBeClickable(); updateCart.Click(); App.BrowserService.WaitUntilReady(); Span totalSpan = App.ElementCreateService.CreateByXpath <Span>("//*[@class='order-total']//span"); // 15. The same as the case with the DIV here we wait/assert for the total price SPAN to get updated. ////Assert.AreEqual("114.00€", totalSpan.InnerText); totalSpan.ValidateInnerTextIs("114.00€", 15000); Anchor proceedToCheckout = App.ElementCreateService.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward"); proceedToCheckout.Click(); // 16. As mentioned before, BELLATRIX has special synchronisation mechanism for locating elements, so usually, there is no need to wait for specific // elements to appear on the page. However, there may be some rare cases when you need to do it. // Bellow the statement finds the heading by its inner text containing the text 'Billing details'. Heading billingDetailsHeading = App.ElementCreateService.CreateByInnerTextContaining <Heading>("Billing details"); // Wait for the heading with the above text to be visible. This means that the correct page is loaded. billingDetailsHeading.ToBeVisible().WaitToBe(); Anchor showLogin = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Click here to login"); // 17. All web controls have multiple properties for their most important attributes and Validate methods for their verification. ////Assert.AreEqual("http://demos.bellatrix.solutions/checkout/#", showLogin.Href); showLogin.ValidateHrefIs("http://demos.bellatrix.solutions/checkout/#"); ////Assert.AreEqual("showlogin", showLogin.CssClass); showLogin.ValidateCssClassIs("showlogin"); TextArea orderCommentsTextArea = App.ElementCreateService.CreateById <TextArea>("order_comments"); // 18. Here we find the order comments text area and since it is below the visible area we scroll down // so that it gets visible on the video recordings. Then the text is set. orderCommentsTextArea.ScrollToVisible(); orderCommentsTextArea.SetText( "Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean..."); TextField billingFirstName = App.ElementCreateService.CreateById <TextField>("billing_first_name"); billingFirstName.SetText("In"); TextField billingLastName = App.ElementCreateService.CreateById <TextField>("billing_last_name"); billingLastName.SetText("Deepthought"); TextField billingCompany = App.ElementCreateService.CreateById <TextField>("billing_company"); billingCompany.SetText("Automate The Planet Ltd."); Select billingCountry = App.ElementCreateService.CreateById <Select>("billing_country"); billingCountry.SelectByText("Bulgaria"); TextField billingAddress1 = App.ElementCreateService.CreateById <TextField>("billing_address_1"); // 19. Through the Placeholder, you can get the default text of the control. Assert.AreEqual("House number and street name", billingAddress1.Placeholder); billingAddress1.SetText("bul. Yerusalim 5"); TextField billingAddress2 = App.ElementCreateService.CreateById <TextField>("billing_address_2"); billingAddress2.SetText("bul. Yerusalim 6"); TextField billingCity = App.ElementCreateService.CreateById <TextField>("billing_city"); billingCity.SetText("Sofia"); Select billingState = App.ElementCreateService.CreateById <Select>("billing_state").ToBeVisible() .ToBeClickable(); billingState.SelectByText("Sofia-Grad"); TextField billingZip = App.ElementCreateService.CreateById <TextField>("billing_postcode"); billingZip.SetText("1000"); Phone billingPhone = App.ElementCreateService.CreateById <Phone>("billing_phone"); // 20. Create the special text field control Phone it contains some additional properties unique for this web element. billingPhone.SetPhone("+00359894646464"); Email billingEmail = App.ElementCreateService.CreateById <Email>("billing_email"); // 21. Here we create the special text field control Email it contains some additional properties unique for this web element. billingEmail.SetEmail("*****@*****.**"); CheckBox createAccountCheckBox = App.ElementCreateService.CreateById <CheckBox>("createaccount"); // 22. You can check and uncheck checkboxes. createAccountCheckBox.Check(); // 23. Bellow BELLATRIX finds the first RadioButton with attribute 'for' containing the value 'payment_method_cheque'. RadioButton checkPaymentsRadioButton = App.ElementCreateService.CreateByAttributesContaining <RadioButton>("for", "payment_method_cheque"); // The radio buttons compared to checkboxes cannot be unchecked/unselected. checkPaymentsRadioButton.Click(); }
public void PurchaseRocketWithoutPageObjects20() { App.TestCases.AddPrecondition($"Navigate to http://demos.bellatrix.solutions/"); App.NavigationService.Navigate("http://demos.bellatrix.solutions/"); Select sortDropDown = App.ElementCreateService.CreateByNameEndingWith <Select>("orderby"); Anchor protonMReadMoreButton = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Read more"); Anchor addToCartFalcon9 = App.ElementCreateService.CreateByAttributesContaining <Anchor>("data-product_id", "28").ToBeClickable(); Anchor viewCartButton = App.ElementCreateService.CreateByClassContaining <Anchor>("added_to_cart wc-forward").ToBeClickable(); sortDropDown.SelectByText("Sort by price: low to high"); protonMReadMoreButton.Hover(); addToCartFalcon9.Focus(); addToCartFalcon9.Click(); viewCartButton.Click(); TextField couponCodeTextField = App.ElementCreateService.CreateById <TextField>("coupon_code"); Button applyCouponButton = App.ElementCreateService.CreateByValueContaining <Button>("Apply coupon"); Div messageAlert = App.ElementCreateService.CreateByClassContaining <Div>("woocommerce-message"); Anchor proceedToCheckout = App.ElementCreateService.CreateByClassContaining <Anchor>("checkout-button button alt wc-forward"); couponCodeTextField.SetText("happybirthday"); applyCouponButton.Click(); messageAlert.ToHasContent().ToBeVisible().WaitToBe(); messageAlert.ValidateInnerTextIs("Coupon code applied successfully."); App.BrowserService.WaitUntilReady(); proceedToCheckout.Click(); Heading billingDetailsHeading = App.ElementCreateService.CreateByInnerTextContaining <Heading>("Billing details"); Anchor showLogin = App.ElementCreateService.CreateByInnerTextContaining <Anchor>("Click here to login"); TextArea orderCommentsTextArea = App.ElementCreateService.CreateById <TextArea>("order_comments"); TextField billingFirstName = App.ElementCreateService.CreateById <TextField>("billing_first_name"); TextField billingLastName = App.ElementCreateService.CreateById <TextField>("billing_last_name"); TextField billingCompany = App.ElementCreateService.CreateById <TextField>("billing_company"); Select billingCountry = App.ElementCreateService.CreateById <Select>("billing_country"); TextField billingAddress1 = App.ElementCreateService.CreateById <TextField>("billing_address_1"); TextField billingAddress2 = App.ElementCreateService.CreateById <TextField>("billing_address_2"); TextField billingCity = App.ElementCreateService.CreateById <TextField>("billing_city"); Select billingState = App.ElementCreateService.CreateById <Select>("billing_state").ToBeVisible().ToBeClickable(); TextField billingZip = App.ElementCreateService.CreateById <TextField>("billing_postcode"); Phone billingPhone = App.ElementCreateService.CreateById <Phone>("billing_phone"); Email billingEmail = App.ElementCreateService.CreateById <Email>("billing_email"); CheckBox createAccountCheckBox = App.ElementCreateService.CreateById <CheckBox>("createaccount"); RadioButton checkPaymentsRadioButton = App.ElementCreateService.CreateByAttributesContaining <RadioButton>("for", "payment_method_cheque"); billingDetailsHeading.ToBeVisible().WaitToBe(); showLogin.ValidateHrefIs("http://demos.bellatrix.solutions/checkout/#"); showLogin.ValidateCssClassIs("showlogin"); orderCommentsTextArea.ScrollToVisible(); orderCommentsTextArea.SetText("Please send the rocket to my door step! And don't use the elevator, they don't like when it is not clean..."); billingFirstName.SetText("In"); billingLastName.SetText("Deepthought"); billingCompany.SetText("Automate The Planet Ltd."); billingCountry.SelectByText("Bulgaria"); billingAddress1.ValidatePlaceholderIs("House number and street name"); billingAddress1.SetText("bul. Yerusalim 5"); billingAddress2.SetText("bul. Yerusalim 6"); billingCity.SetText("Sofia"); billingState.SelectByText("Sofia-Grad"); billingZip.SetText("1000"); billingPhone.SetPhone("+00359894646464"); billingEmail.SetEmail("*****@*****.**"); createAccountCheckBox.Check(); checkPaymentsRadioButton.Click(); ////Assert.Fail("Ops"); }
//private static UITestControl uIItemCustom; #region 医生新增订单 /// <summary> /// 点击新增订单,直接提交 /// </summary> public static bool AddOrder_Succ(Window appWin, out string msg) { try { var startTime = DateTime.Now; //在菜单页点击新增订单 Button tlOpenAddOrderModule = appWin.Get <Button>(SearchCriteria.ByAutomationId("tlOpenAddOrderModule")); tlOpenAddOrderModule.Click(); //输入姓名 TextBox txtCustomerRealname = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtCustomerRealname")); txtCustomerRealname.BulkText = Generate.GenerateChineseWords(3); //选择性别 RadioButton rbSexGirl = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbSexGirl")); rbSexGirl.Click(); //填写年龄:txtCustomerAge TextBox txtCustomerAge = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtCustomerAge")); txtCustomerAge.Text = "23"; //身份证:txtCustomerPin TextBox txtCustomerPin = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtCustomerPin")); txtCustomerPin.Text = "4400229988776655"; //手机:txtTelphone TextBox txtTelphone = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtTelphone")); txtTelphone.Text = "15500000001"; //主诉:txtContent TextBox txtContent = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtContent")); txtContent.BulkText = Generate.GenerateChineseWords(10); //固定矫治经验:rbFixedExpYes RadioButton rbFixedExpYes = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbFixedExpYes")); rbFixedExpYes.Click(); //是否沟通:rbCommunicateYes RadioButton rbCommunicateYes = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCommunicateYes")); rbCommunicateYes.Click(); //检查情况: //中线位置上颌:rbMidposUpperCentre RadioButton rbMidposUpperCentre = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMidposUpperCentre")); rbMidposUpperCentre.Click(); //中线位置上颌偏离:txtMidposUpperAway TextBox txtMidposUpperAway = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtMidposUpperAway")); txtMidposUpperAway.Text = "2"; //中线位置上颌:rbMidposBelowCentre RadioButton rbMidposBelowCentre = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMidposBelowCentre")); rbMidposBelowCentre.Click(); //中线位置下颌偏离:txtMidposBelowAway TextBox txtMidposBelowAway = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtMidposBelowAway")); txtMidposBelowAway.Text = "2"; //前牙覆颌:txtFrontToothCover TextBox txtFrontToothCover = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtFrontToothCover")); txtFrontToothCover.Text = "2"; //前牙覆盖:txtAnteriorToothCover TextBox txtAnteriorToothCover = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtAnteriorToothCover")); txtAnteriorToothCover.Text = "2"; //磨牙关系右侧:rbMolarRightRecent RadioButton rbMolarRightRecent = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMolarRightRecent")); rbMolarRightRecent.Click(); //磨牙关系左侧:rbMolarLeftNeutral RadioButton rbMolarLeftNeutral = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMolarLeftNeutral")); rbMolarLeftNeutral.Click(); //尖牙关系右侧:rbCanineRightNeutral RadioButton rbCanineRightNeutral = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCanineRightNeutral")); rbCanineRightNeutral.Click(); //尖牙关系左侧:rbCanineLeftRecent RadioButton rbCanineLeftRecent = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCanineLeftRecent")); rbCanineLeftRecent.Click(); //面型:rbFaceTypeConvex RadioButton rbFaceTypeConvex = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbFaceTypeConvex")); rbFaceTypeConvex.Click(); //修复体情况:txtRepairBody TextBox txtRepairBody = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtRepairBody")); txtRepairBody.Text = "2"; //矫治计划 //矫治目标:txtTreatmentGoal TextBox txtTreatmentGoal = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtTreatmentGoal")); txtTreatmentGoal.Text = "2"; //拟矫治牙列:rbDentitionOn RadioButton rbDentitionOn = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbDentitionOn")); rbDentitionOn.Click(); //磨牙保持原有尖牙关系:rbMolarKeepRight RadioButton rbMolarKeepRight = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMolarKeepRight")); rbMolarKeepRight.Click(); //磨牙调整磨牙关系至右侧:rbMolarAdjustRightFar RadioButton rbMolarAdjustRightFar = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMolarAdjustRightFar")); rbMolarAdjustRightFar.Click(); //磨牙调整磨牙关系至左侧:rbMolarAdjustLeftFar RadioButton rbMolarAdjustLeftFar = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMolarAdjustLeftFar")); rbMolarAdjustLeftFar.Click(); //尖牙保持原有尖牙关系:rbCanineKeepLeft RadioButton rbCanineKeepLeft = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCanineKeepLeft")); rbCanineKeepLeft.Click(); //尖牙调整磨牙关系至右侧:rbCanineAdjustRightFar RadioButton rbCanineAdjustRightFar = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCanineAdjustRightFar")); rbCanineAdjustRightFar.Click(); //尖牙调整磨牙关系至左侧:rbCanineAdjustLeftFar RadioButton rbCanineAdjustLeftFar = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCanineAdjustLeftFar")); rbCanineAdjustLeftFar.Click(); //覆颌:rbMalocclusionOn RadioButton rbMalocclusionOn = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbMalocclusionOn")); rbMalocclusionOn.Click(); //覆盖:rbCoverKeep RadioButton rbCoverKeep = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCoverKeep")); rbCoverKeep.Click(); //间隙处理:rbGapCloseAll RadioButton rbGapCloseAll = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbGapCloseAll")); rbGapCloseAll.Click(); //间隙保留:txtGapRemain TextBox txtGapRemain = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtGapRemain")); txtGapRemain.Text = "2"; //后牙锁颌:rbTeethLockKeep RadioButton rbTeethLockKeep = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbTeethLockKeep")); rbTeethLockKeep.Click(); //中线关系:rbCenterLineKeep RadioButton rbCenterLineKeep = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbCenterLineKeep")); rbCenterLineKeep.Click(); //spee曲线:rbSpeeCurveImprove RadioButton rbSpeeCurveImprove = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbSpeeCurveImprove")); rbSpeeCurveImprove.Click(); //同意领面去釉:rbFaceToGlazeNo RadioButton rbFaceToGlazeNo = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbFaceToGlazeNo")); rbFaceToGlazeNo.Click(); //同意领面去釉医生建议:txtFaceToGlazeTeeth TextBox txtFaceToGlazeTeeth = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtFaceToGlazeTeeth")); txtFaceToGlazeTeeth.Text = "2"; //同意拔牙矫治:rbExtractionYes RadioButton rbExtractionYes = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbExtractionYes")); rbExtractionYes.Click(); //同意拔牙矫治医生建议:txtExtractionTeeth TextBox txtExtractionTeeth = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtExtractionTeeth")); txtExtractionTeeth.Text = "2"; //过矫正:rbOverCorrectionYes RadioButton rbOverCorrectionYes = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbOverCorrectionYes")); rbOverCorrectionYes.Click(); //过矫正医生建议:txtOverCorrectionTeeth TextBox txtOverCorrectionTeeth = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtOverCorrectionTeeth")); txtOverCorrectionTeeth.Text = "2"; //面型:rbPlanFaceTypeKeep RadioButton rbPlanFaceTypeKeep = appWin.Get <RadioButton>(SearchCriteria.ByAutomationId("rbPlanFaceTypeKeep")); rbPlanFaceTypeKeep.Click(); //特殊要求:txtSpecialDemands TextBox txtSpecialDemands = appWin.Get <TextBox>(SearchCriteria.ByAutomationId("txtSpecialDemands")); txtSpecialDemands.Text = "2"; //附件资料: //上传1:hgFrontViewPic ImageLoadingControl UIA_CustomControlTypeId // Image hgFrontViewPic = appWin.Get<Image>(SearchCriteria.ByAutomationId("hgFrontViewPic")); //hgFrontViewPic.Click(); //TextBox text = appWin.Get<TextBox>(); //Mouse.Click(uIItemCustom, new Point(165, 85)); //var item = appWin.Get<Image>(SearchCriteria.ByAutomationId("hgFrontViewPic")); //Image imageShow = item.<Image>(SearchCriteria.ByAutomationId("imageShow")).; //imageShow.Click();x:377 y:869 appWin.Mouse.Click(new System.Windows.Point(377, 869)); //上传图片 var selectWin1 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag1 = selectWin1.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag1.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn1 = selectWin1.Get <Button>(SearchCriteria.ByAutomationId("1")); btn1.Click(); //上传2:hgFrontCoverPic Button hgFrontCoverPic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgFrontCoverPic")); hgFrontCoverPic.Click(); //Mouse.Click(uIItemCustom1, new Point(177, 250)); //上传图片 var selectWin2 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag2 = selectWin2.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag2.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn2 = selectWin2.Get <Button>(SearchCriteria.ByAutomationId("1")); btn2.Click(); //上传3:hgLeftInsidePic Button hgLeftInsidePic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgLeftInsidePic")); hgLeftInsidePic.Click(); //Mouse.Click(uIItemCustom2, new Point(215, 218)); //Mouse.Click(uIItemCustom3, new Point(185, 86)); //Mouse.Click(uIItemCustom4, new Point(144, 57)); //Mouse.Click(uIItemCustom5, new Point(189, 79)); //Mouse.Click(uIItemCustom6, new Point(151, 244)); //Mouse.Click(uIItemCustom7, new Point(191, 265)); //Mouse.Click(uIItemCustom8, new Point(115, 267)); //Mouse.Click(uIItemCustom9, new Point(173, 220)); //Mouse.Click(uIItemCustom10, new Point(223, 263)); //上传图片 var selectWin3 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag3 = selectWin3.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag3.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn3 = selectWin3.Get <Button>(SearchCriteria.ByAutomationId("1")); btn3.Click(); //上传4:hgRightInsidePic Button hgRightInsidePic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgRightInsidePic")); hgRightInsidePic.Click(); //上传图片 var selectWin4 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag4 = selectWin4.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag4.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn4 = selectWin4.Get <Button>(SearchCriteria.ByAutomationId("1")); btn4.Click(); //上传5:hgTopInsidePic Button hgTopInsidePic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgTopInsidePic")); hgTopInsidePic.Click(); //上传图片 var selectWin5 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag5 = selectWin5.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag5.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn5 = selectWin5.Get <Button>(SearchCriteria.ByAutomationId("1")); btn5.Click(); //上传6:hgBottomInsidePic Button hgBottomInsidePic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgBottomInsidePic")); hgBottomInsidePic.Click(); //上传图片 var selectWin6 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag6 = selectWin6.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag6.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn6 = selectWin6.Get <Button>(SearchCriteria.ByAutomationId("1")); btn6.Click(); //上传7:hgOutInsidePic Button hgOutInsidePic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgOutInsidePic")); hgOutInsidePic.Click(); //上传图片 var selectWin7 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag7 = selectWin7.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag7.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn7 = selectWin7.Get <Button>(SearchCriteria.ByAutomationId("1")); btn7.Click(); //上传8:hgFrontOutsideSmile Button hgFrontOutsideSmile = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgFrontOutsideSmile")); hgFrontOutsideSmile.Click(); //上传图片 var selectWin8 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag8 = selectWin8.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag8.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn8 = selectWin8.Get <Button>(SearchCriteria.ByAutomationId("1")); btn8.Click(); //上传9:hgRightOutsidePic Button hgRightOutsidePic = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgRightOutsidePic")); hgRightOutsidePic.Click(); //上传图片 var selectWin11 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag11 = selectWin11.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag11.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn11 = selectWin11.Get <Button>(SearchCriteria.ByAutomationId("1")); btn11.Click(); //上传10:hgFullMouthSurface Button hgFullMouthSurface = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgFullMouthSurface")); hgFullMouthSurface.Click(); //上传图片 var selectWin12 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag12 = selectWin12.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag12.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn12 = selectWin12.Get <Button>(SearchCriteria.ByAutomationId("1")); btn12.Click(); //上传11:hgLateralProjection Button hgLateralProjection = appWin.Get <Button>(SearchCriteria.ByAutomationId("hgLateralProjection")); hgLateralProjection.Click(); //上传图片 var selectWin13 = appWin.MdiChild(SearchCriteria.ByText("选择文件")); TextBox tbImag13 = selectWin13.Get <TextBox>(SearchCriteria.ByAutomationId("1148")); tbImag13.BulkText = AppDomain.CurrentDomain.BaseDirectory + @"Resourse\Images\3.jpg"; Button btn13 = selectWin13.Get <Button>(SearchCriteria.ByAutomationId("1")); btn13.Click(); //提交订单 btnAddOrder Button btnAddOrder = appWin.Get <Button>(SearchCriteria.ByAutomationId("btnAddOrder")); btnAddOrder.Click(); var endTime = DateTime.Now; msg = "测试【点击新增订单菜单】--通过,用时:" + (endTime - startTime).TotalSeconds; return(true); } catch (Exception e) { msg = "测试【点击新增订单菜单】--失败,原因:" + e.Message; return(true); } #endregion }