public static void If_Application_Is_Not_unInstall(string UninstallBuildname) { try { Ranorex.Text App_uninstall = "/form[@title~'Smart Fit' or @title~'Solus Max' or @title~'Audigy']/text[@windowtext~'A newer or same version of this application is already installed on this computer. If you wish to install this version, please uninstall the installed version first.']"; if (App_uninstall.Visible == true) { Ranorex.Button btnOk = "/form[@title~'Smart Fit' or @title~'Solus Max' or @title~'Audigy']/button[@text='OK']"; Mouse.Click(btnOk); Delay.Seconds(5); Process p = new Process(); Delay.Seconds(3); p.StartInfo.FileName = @"D:\TFS\FSW\TestSuites\Market_Preferences\Builds\" + UninstallBuildname + "\\Setup.exe"; // p.StartInfo.FileName = @"~\Desktop\Market_Preferences\Builds\"+UninstallBuildname+"\\Setup.exe"; p.StartInfo.Arguments = "/x /v/qn"; p.Start(); Delay.Seconds(5); } } catch { Ranorex.Button cancelbtn = "/form[@title~'Smart Fit' or @title~'Solus Max' or @title~'Audigy']/button[@text='Cancel']"; Mouse.Click(cancelbtn); Delay.Seconds(3); } }
/// <summary> /// Scroll to specified direction and search for treeItem /// </summary> /// <param name="button">Button to use for scrolling</param> /// <param name="pathPart">TreeItem to search for</param> /// <param name="lastFoundTreeItemChildIndex">Reference to the latest found tree item</param> /// <returns> /// <br>TreeItem: If call worked fine</br> /// <br>Null: If an error occurred</br> /// </returns> private TreeItem ScrollAndSearchTreeItem(Button button, string pathPart, int lastFoundTreeItemChildIndex) { try { bool isSearching = true; TreeItem treeItem = null; // While no element is found and search is going on while (treeItem == null && isSearching) { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Scrolling...And...Searching..."); button.Click(DefaultValues.locDefaultLocation); treeItem = NavigationElements.GetTreeItem(pathPart, lastFoundTreeItemChildIndex); if (button.ScreenRectangle.Size.Height == 0) { isSearching = false; } } return(treeItem); } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); return(null); } }
public static void Exit_withOut_Saving_Button() { Delay.Seconds(4); // Ranorex.Button btnExit="/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/button[@automationid='PART_PositiveButton']"; Ranorex.Button btnExit="/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/button[2]"; Mouse.Click(btnExit); }
/// <summary> /// Start via related menu-entry /// </summary> /// <returns> /// <br>Button: If call worked fine</br> /// <br>NULL: If an error occurred</br> /// </returns> public bool ViaMenu() { try { Element element = (new RunStopEditMAP()).ViaMenu(); if (element != null && element.Enabled) { Button button = (new Elements()).EntryDiscardMAPEditing; if (button != null && button.Enabled) { Mouse.MoveTo(button, 500); button.Click(DefaultValues.locDefaultLocation); return(true); } EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Menu entry is not accessable."); return(false); } EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Function is not accessable."); return(false); } catch (Exception exception) { EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); return(false); } }
public static bool ClickThis(this Ranorex.Button item) { System.Threading.Thread.Sleep(200); item.Click(); System.Threading.Thread.Sleep(200); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="CheckThatParameterAreNotInvalid"/> class. /// </summary> public CheckThatParameterAreNotInvalid() { Container dataPanelBuffer; this.navigationArea = new Navigation(); Host.Local.TryFindSingle(NavigationPaths.StrNaviAreaVerticalScrollBarElement, out this.elementScrollBar); Host.Local.TryFindSingle(NavigationPaths.StrNaviAreaTreeDataPanel, out dataPanelBuffer); this.navigationArea.DataPanel = dataPanelBuffer; this.numberOfMenus = 0; this.numberOfParameter = 0; this.numberOfParameterInvalid = 0; this.numberOfParameterValid = 0; this.numberOfParameterDynamic = 0; this.numberOfParameterInsecure = 0; this.numberOfParameterModified = 0; this.buttonLineDown = null; this.buttonPageDown = null; this.isButtonScrollBarDownInitialized = false; this.result = true; this.isOngoing = true; this.isUpdatedNeeded = false; this.counter = 0; this.lastIndex = 0; if (this.navigationArea.DataPanel != null) { this.navigationArea.DataPanelChildren = this.navigationArea.DataPanel.FindChildren <TreeItem>(); this.numberOfChildsBeforeUpdate = this.navigationArea.DataPanelChildren.Count; } }
public void KliknijWIkoneUsunWWierszu(int numerWiersza) { //jeżeli istnieją tabele gdzie ikona usuń jest w innej kolumnie to do poprawki var wiersz = _znajdzWKontenerze?_container.FindSingle(String.Format(".//element[@automationid='RowsPresenter']/element[@childindex={0}]", numerWiersza - 1)): _okno.FindSingle(String.Format(".//element[@automationid='RowsPresenter']/element[@childindex={0}]", numerWiersza - 1)); Button przycisk = wiersz.FindSingle("./element[1]/button[@visible='true']"); przycisk.Click(); }
public static void Select(this Ranorex.ComboBox combobox, string item) { // create button Ranorex.Button mybutton = combobox.FindSingle(combobox.GetPath().ToString() + "/button[@accessiblename='Open' or @text='>']"); mybutton.Click(); // create list item to click on Ranorex.ListItem myList = combobox.FindSingle(String.Format("/list[@controlid='1000']/listitem[@text='{0}']", item)); myList.Click(); }
public static void ClickThis(this Ranorex.Button item) { try { item.Click(); Sleep(); } catch (Exception ex) { throw new Exception("Button Click Failed : " + ex.Message); } }
/// <summary> /// Initializes a new instance of the <see cref="Navigation"/> class. /// </summary> public Navigation() { this.buttonLineDown = null; this.buttonPageDown = null; this.isButtonScrollBarDownInitialized = false; this.isDataPanelInitialized = false; this.isOngoing = true; this.isUpdatedNeeded = false; this.counter = 0; this.lastIndex = 0; this.numberOfChilds = 0; this.InitializeDataPanel(); this.InitializeScrollbar(); this.listOfInvalidParameters = new List <string>(); }
public static void ExtraNext_Button() { Delay.Seconds(4); try { Ranorex.Button btnNext = "/form[@title~'Smart Fit' or @title~'Solus Max']/button[@text='&Next >']"; if (btnNext.Visible == true) { Mouse.Click(btnNext); } } catch { } }
public static void Changing_Bimodal_userGuide() { Delay.Seconds(3); Ranorex.Button btnBimodal = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/container/button[8]"; if (btnBimodal.Pressed == false) { Mouse.Click(btnBimodal); Delay.Seconds(3); Ranorex.Button btn_Save = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/button[4]"; Mouse.Click(btn_Save); } else { Ranorex.Button btn_X_preference = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/button[@name='Close']"; Mouse.Click(btn_X_preference); } }
public static void Function2() { Ranorex.Button buttonLoad_template = null; buttonLoad_template = "/dom[@domain~'^.*']/body/flexobject/form/element[@type='ControlBar']/button[@text='Load template...']"; buttonLoad_template.Click(); Ranorex.Form formChoose_Template = null; formChoose_Template = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']"; formChoose_Template.Click(); Ranorex.Button buttonButton = null; Ranorex.Button buttonButton2 = "/dom[@domain='10.200.20.36:8888']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']"; buttonButton = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']"; buttonButton2.Click(); buttonButton2.Click(); //formChoose_Template.Click(); //Ranorex.Form formChoose_Template1 = "/dom[@domain='10.200.20.65:8282']/body/flexobject/form[@title='Choose Template']"; List listList = null; //formChoose_Template1.Click(); listList = "/dom[@domain~'^.*']/body/flexobject/list[@type='List']"; int count = listList.Items.Count; int i = 1; Ranorex.Button buttonLoad = null; buttonLoad = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/element[@type='ControlBar']/button[@text='Load']"; foreach (Ranorex.ListItem item in listList.Items) { Keyboard.Press(Keys.Down, 80, Keyboard.DefaultKeyPressTime, 1, false); Report.Info(item.Text); i = i + 1; if (param == item.Text) { if (i < count) { Keyboard.Press(Keys.Up, 80, Keyboard.DefaultKeyPressTime, 1, false); } buttonLoad.Click(); break; } else { Report.Info(item.Text + " doesnt matched with " + param); } } }
public static void Function2() { Ranorex.Button buttonLoad_template = null; buttonLoad_template = "/dom[@domain~'^.*']/body/flexobject/form/element[@type='ControlBar']/button[@text='Load template...']"; buttonLoad_template.Click(); Ranorex.Form formChoose_Template = null; formChoose_Template = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']"; formChoose_Template.Click(); Ranorex.Button buttonButton = null; buttonButton = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']"; buttonButton.Click(); Ranorex.Button buttonButton1 = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']"; buttonButton1.Click(); buttonButton1.Click(); List listList = null; listList = "/dom[@domain~'^.*']/body/flexobject/list[@type='List']"; int count = listList.Items.Count; // messagebox.Show(count) int i = 1; Ranorex.Button buttonLoad = null; buttonLoad = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/element[@type='ControlBar']/button[@text='Load']"; foreach (Ranorex.ListItem item in listList.Items) { Keyboard.Press(Keys.Down, 80, Keyboard.DefaultKeyPressTime, 1, false); Report.Info(item.Text); i = i + 1; if (process_name == item.Text) { // if (i < count) { // Keyboard.Press(Keys.Up, 80, Keyboard.DefaultKeyPressTime, 1, false); // } // MessageBox.Show(item.Text); buttonLoad.Click(); break; } else { Report.Info(item.Text + " doesnt matched with " + process_name); } } }
public static void Fetching_Machine_Preference() { int _ComboBoxCount = 0; FSW_MachinePreference_List.Clear(); DefaultValues_MachinePreference_List.Clear(); Ranorex.Container Container_Machine_Prefernces = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container[@automationid='PART_ExtendedScrollViewer']"; IList <UIAutomation> Machine_Preferncest_list = Container_Machine_Prefernces.FindChildren <UIAutomation>(); for (int i = 0; i <= Machine_Preferncest_list.Count - 4; i++) { string name = Machine_Preferncest_list[i].Name; if (name != null) { // fswprefernce=fswprefernce.Replace(" ",string.Empty); //name=name.Replace(":",string.Empty); name = name.Replace(":", string.Empty); if (!(name == null || name == "Test" || name == "Parameters" || name == "Yes")) { // FSW_MachinePreference_List.Add(Machine_Preferncest_list[i].Name); if (name == "Pediatric Default Target Rule") { FSW_MachinePreference_List.Add("Default Pediatric Fitting Rule"); } else if (name == "Default Experience") { FSW_MachinePreference_List.Add("Default Experience Level"); } else if (name == "Show GN Online Services System Tray Icon") { FSW_MachinePreference_List.Add("System Tray Visibility"); } else if (name == "Programming Interface") { FSW_MachinePreference_List.Add("Default Programming Interface"); } else { FSW_MachinePreference_List.Add(name); } } } } ElementList_Count.Clear(); for (int j = 0; j <= Machine_Preferncest_list.Count - 4; j++) { string elementname = Machine_Preferncest_list[j].ControlType; if (elementname == "ComboBox" || elementname == "CheckBox" || elementname == "Button") { if (elementname == "Button") { if (Machine_Preferncest_list[j].Name == "Yes") { ElementList_Count.Add(elementname); } } else { ElementList_Count.Add(elementname); } } } for (int k = 0; k <= ElementList_Count.Count - 1; k++) { if (ElementList_Count[k] == "ComboBox") { int m = _ComboBoxCount + 1; // int m= Ranorex.ComboBox Comb_text = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/combobox[" + m + "]"; string defvalue = Comb_text.Text; if (defvalue == "DSLv5 - Pediatric") { DefaultValues_MachinePreference_List.Add("DSLv5b - Pediatric"); } else { DefaultValues_MachinePreference_List.Add(defvalue); } _ComboBoxCount++; } else if (ElementList_Count[k] == "CheckBox" || ElementList_Count[k] == "Button") { if (ElementList_Count[k] == "CheckBox") { Ranorex.CheckBox checkedCondition = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/checkbox[@automationid='PART_UsePinCodeCheckBox']"; if (checkedCondition.Checked == true) { DefaultValues_MachinePreference_List.Add("Yes"); } else { DefaultValues_MachinePreference_List.Add("No"); } } else if (ElementList_Count[k] == "Button") { Ranorex.Button btnpressedCondition = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/button[@automationid='PART_SegmentedToggleButton']"; if (btnpressedCondition.Pressed == true) { DefaultValues_MachinePreference_List.Add("Yes"); } else { DefaultValues_MachinePreference_List.Add("No"); } } } } }
public void ClickButton(string buttonpath) { Button btn = buttonpath; btn.Click(); }
public static void Fetching_UserPreference_DefaultValues(string buildname) { FSW_UserPreference_Default_List.Clear(); int _comboboxCount = 0; int _buttonCount = 0; int _ContainerCount = 0; buildname = buildname.Replace(" ", string.Empty); buildname = buildname.ToLower(); if (buildname.Contains("smartfit")) { Ranorex.Container Container_UserPrefernces = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container[@automationid='PART_ExtendedScrollViewer']"; IList <UIAutomation> C_List = Container_UserPrefernces.FindChildren <UIAutomation>(); for (int i = 0; i <= C_List.Count - 4; i++) { if (C_List[i].ControlType == "ComboBox") { int ComboboxNumber = _comboboxCount + 1; if (ComboboxNumber == 1) { Ranorex.ComboBox seletedcombobox = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/combobox[" + ComboboxNumber + "]"; _comboboxCount++; } else { Ranorex.ComboBox seletedcombobox = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/combobox[" + ComboboxNumber + "]"; if (seletedcombobox.Text == "Fitting Screen: Gain Adjustment") { FSW_UserPreference_Default_List.Add("Fit Screen: Gain Adjustment"); } else if (seletedcombobox.Text == "Enter in Simulation Mode") { FSW_UserPreference_Default_List.Add("Connect Manually"); } else { FSW_UserPreference_Default_List.Add(seletedcombobox.Text); } _comboboxCount++; } } if (C_List[i].ControlType == "Group") { int ContainerNumber = _ContainerCount + 1; Ranorex.Container ContainetTxT = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container[@automationid='PART_ExtendedScrollViewer']/container[" + ContainerNumber + "]"; IList <ComboBox> Container_Combobox = ContainetTxT.FindChildren <ComboBox>(); IList <Button> Container_Button = ContainetTxT.FindChildren <Button>(); if (C_List[i].Name != "Default Environmental Programs:") { FSW_UserPreference_Default_List.Add("Yes"); } for (int j = 0; j <= Container_Combobox.Count - 1; j++) { int j1 = j + 1; Ranorex.ComboBox seletedcombobox = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/container[" + ContainerNumber + "]/combobox[" + j1 + "]"; FSW_UserPreference_Default_List.Add(seletedcombobox.Text); } for (int k = 0; k <= Container_Button.Count - 1; k++) { int k1 = k + 1; if (k1 == 1) { Ranorex.Button selectedButton = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/container[" + ContainerNumber + "]/button[" + k1 + "]"; // FSW_UserPreference_Default_List.Add(selectedButton.Text); if (selectedButton.Pressed == true) { FSW_UserPreference_Default_List.Add("Yes"); } else { FSW_UserPreference_Default_List.Add("No"); } } if (k1 == 2) { Ranorex.Button selectedButton = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/container[" + ContainerNumber + "]/button[" + k1 + "]"; if (selectedButton.Pressed == true) { FSW_UserPreference_Default_List.Add("Yes"); } else { FSW_UserPreference_Default_List.Add("No"); } } } _ContainerCount++; } if (C_List[i].ControlType == "Button") { int ButtonNumber = _buttonCount + 1; Ranorex.Button seletedButton = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/button[" + ButtonNumber + "]"; if (seletedButton.Pressed == true) { FSW_UserPreference_Default_List.Add("Yes"); } else { FSW_UserPreference_Default_List.Add("No"); } _buttonCount++; } } } else if (buildname.Contains("solusmax") || buildname.Contains("audigy")) { Ranorex.Container Container_UserPrefernces = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container[@automationid='PART_ExtendedScrollViewer']"; IList <UIAutomation> C_List = Container_UserPrefernces.FindChildren <UIAutomation>(); for (int i = 0; i <= C_List.Count - 4; i++) { if (C_List[i].ControlType == "ComboBox") { int ComboboxNumber = _comboboxCount + 1; if (ComboboxNumber == 1) { Ranorex.ComboBox seletedcombobox = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/combobox[" + ComboboxNumber + "]"; _comboboxCount++; } else { Ranorex.ComboBox seletedcombobox = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/combobox[" + ComboboxNumber + "]"; if (seletedcombobox.Text == "Fitting Screen: Gain Adjustment") { FSW_UserPreference_Default_List.Add("Fit Screen: Gain Adjustment"); } else if (seletedcombobox.Text == "Enter in Simulation Mode") { FSW_UserPreference_Default_List.Add("Connect Manually"); } else { FSW_UserPreference_Default_List.Add(seletedcombobox.Text); } _comboboxCount++; } } if (C_List[i].ControlType == "Group") { int ContainerNumber = _ContainerCount + 1; Ranorex.Container ContainetTxT = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container[@automationid='PART_ExtendedScrollViewer']/container[" + ContainerNumber + "]"; IList <ComboBox> Container_Combobox = ContainetTxT.FindChildren <ComboBox>(); IList <Button> Container_Button = ContainetTxT.FindChildren <Button>(); if (C_List[i].Name != "Default Environmental Programs:") { FSW_UserPreference_Default_List.Add("Yes"); } for (int j = 0; j <= Container_Combobox.Count - 1; j++) { int j1 = j + 1; Ranorex.ComboBox seletedcombobox = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/container[" + ContainerNumber + "]/combobox[" + j1 + "]"; FSW_UserPreference_Default_List.Add(seletedcombobox.Text); } for (int k = 0; k <= Container_Button.Count - 1; k++) { int k1 = k + 1; if (k1 == 1) { Ranorex.Button selectedButton = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/container[" + ContainerNumber + "]/button[" + k1 + "]"; // FSW_UserPreference_Default_List.Add(selectedButton.Text); if (selectedButton.Pressed == true) { FSW_UserPreference_Default_List.Add("Yes"); } else { FSW_UserPreference_Default_List.Add("No"); } } if (k1 == 2) { Ranorex.Button selectedButton = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/container[" + ContainerNumber + "]/button[" + k1 + "]"; if (selectedButton.Pressed == true) { FSW_UserPreference_Default_List.Add("Yes"); } else { FSW_UserPreference_Default_List.Add("No"); } } } _ContainerCount++; } if (C_List[i].ControlType == "Button") { int ButtonNumber = _buttonCount + 1; Ranorex.Button seletedButton = "/form[@classname='Window' and @orientation='None' and @processname='SmartFit' or @processname='SolusMax']/container/button[" + ButtonNumber + "]"; if (seletedButton.Pressed == true) { FSW_UserPreference_Default_List.Add("Yes"); } else { FSW_UserPreference_Default_List.Add("No"); } _buttonCount++; } } } }
//********************************************************************** /// <summary> /// Form action: VerifyProperty equal, Contains, NotContains. /// </summary> public static void VerifyProperty(LxScriptItem item) { //MessageBox.Show(item.getComponent().ToString()); // The component is lable string testtemp = item.getComponent().ToString(); if (item.getComponent().ToString().IndexOf("Lbl") != -1) { Ranorex.NativeWindow nativeWnd = item.getComponentInfo().CreateAdapter <Ranorex.NativeWindow>(false); string lableText = nativeWnd.WindowText; if (item.getArg2Text() == "Equal") { string abc = item.getArg3Text(); Validate.AreEqual(lableText, item.getArg3Text()); } if (item.getArg2Text() == "Contains") { int iFlag = lableText.IndexOf(item.getArg3Text()); Validate.IsTrue(iFlag != -1); } if (item.getArg2Text() == "NotContains") { int iFlag = lableText.IndexOf(item.getArg3Text()); Validate.IsTrue(iFlag == -1); } return; } if (item.getArg2Text() == "Equal") { Validate.Attribute(item.getComponentInfo(), item.getArgText(), item.getArg3Text()); } if (item.getArg2Text() == "Contains") { Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex(Regex.Escape(item.getArg3Text()))); } if (item.getArg2Text() == "NotContains") { Validate.Attribute(item.getComponentInfo(), item.getArgText(), new Regex("^((?!(" + Regex.Escape(item.getArg3Text()) + ")).)*$")); } if (item.getArg2Text() == "ListContains") { bool Resultflag = false; object objComponet = item.getComponent(); Ranorex.ComboBox myComboBox = (Ranorex.ComboBox)(objComponet); Ranorex.Button btn = myComboBox.FindSingle("./button"); btn.Click(); List lst = "/list"; foreach (ListItem lst_item in lst.FindChildren <ListItem>()) { if ((lst_item.Text).Equals(item.getArg3Text())) { Resultflag = true; break; } } btn.Click(); Validate.AreEqual(Resultflag, true); } }
public static void X_Click() { Ranorex.Button X_btn="/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/button[@name='Close']"; Mouse.Click(X_btn); }
public static void Save_button_Click() { Ranorex.Button saveButton="/form[@classname='Window' and @orientation='None' and @processname='SmartFit']/button[4]"; Mouse.Click(saveButton); }
public SilverlightTable PobierzValdict(string kolumna, int wiersz, string opcjalnyFiltrDoValdicta = "") { var field = Fields.ToList().Find(s => s.Label == kolumna); if (field.Type != FieldTypes.VALDICT) { throw new Exception("Wybrana kolumna nie jest valdictem."); } var x = KomorkaWTabelce(kolumna, wiersz); //text var element = x.Element.Parent; //element //nie moja magia jeszcze nie wnikałem AA #region przesuwanie o 1 pole do przodu zeby uniknac problemow z niewidocznym buttonem pomimo ze jest visible int ci = x.Element.Parent.ChildIndex; int ilosckolumn = InternalTable[0].Count(); //z headera string path = ""; if (ci < ilosckolumn) { path = string.Format(".//element[@childindex='{0}']", ci + 1); } ZnajdzWKontenerzeLubOknie <Unknown>(path).EnsureVisible(); //scenariusz 02_08_087 jest w poniższy sposób naprawiony, ale te child indexy wyżej dalej są źle //bo nie uwzględniają niewidzialnych kolumn. Trzeba by bylo je jakoś zgodnie numerować żeby znać //PRAWDZIWĄ ilość, jeśli pojawi się kiedyś jakiś problem. To tak na przyszłość - LK //updejt o 14:28 - O, już wiem, może po prostu pod ilosckolumn podstawić childIndex ostatniej kolumny (czyli maksymalny)? if (InternalTable[0].Last().TextValue == kolumna) { Keyboard.Down(Keys.Shift); Keyboard.Press(Keys.End); Keyboard.Up(Keys.Shift); } #endregion element.EnsureVisible(); element.As <Unknown>().Click(); //klikamy w button, valdict sie rozwija, wybieramy dane z listy Button button = button = element.FindSingle("./button[@automationid='ButtonOpen']").As <Button>(); if (opcjalnyFiltrDoValdicta == "") { button.EnsureVisible(); button.Click(); //czarna strzalka pojawia sie po nacisnieciu na komorke } else //klikamy na valdict, wpisujemy wartosc ktora JEST FILTREM, valdict sie rozwija, klikamy na wartosc tekstowa w rozwinietym menu { Keyboard.Press(opcjalnyFiltrDoValdicta); Keyboard.Press(Keys.Enter); } WaitForProgressBarInElement(element.As <Unknown>()); //progressbar tam jest i czyha - atakuje gdy valdict ładuje dane var list = element.Find("./form/list/listitem/text"); var ileKolumnWValdict = (from li in list select li.ChildIndex).Max(); var valdict = new List <List <string> >(); for (var i = 0; i < list.Count();) { var row = new List <string>(); while (i < list.Count() && list[i].ChildIndex < ileKolumnWValdict)//dodaje mniejsze od max child indexa { row.Add(list[i++].As <Text>().TextValue); } row.Add(list[i++].As <Text>().TextValue);//i na koniec maksymalnego child indexa valdict.Add(row); } button.Click();//zamykanie valdicta for (int i = 0; i < valdict.Count; i++) { for (int j = 0; j < valdict[i].Count; j++) { DebugLog(String.Format("[{0},{1}]: {2}", i, j, valdict[i][j])); } } return(new SilverlightTable(valdict)); }