dataGrid Values validation
dataGrid Values validation
Good afternoon i'm testing Ranorex Studio 2.2 Trial version and at this moment i need to validate if a dataGridValues has 24 lines and 3 columms in a .NET application.
I'm in an internship to complete my graduation on Computer Engineering, and i´ll have to create an automation test platform to automate Manual Test Cases for new releases on Critical Manufacturing company.
´With the validate button on record mode, Ranorex doesn't provide me the contents of a dataGridValues.
It is because i´m using the Trial version?
I need to validate the values of that DataGridValues one by one or exist any other option to do that?
I can validate that if the DataGrid has a certain number of lines and columms without using scripts?If not can you provide me an possible library to do that?
I have a litle hurry because at this time i need to choose which tool i'll use to the internship.
Best regards
email: [email protected] or [email protected]
I'm in an internship to complete my graduation on Computer Engineering, and i´ll have to create an automation test platform to automate Manual Test Cases for new releases on Critical Manufacturing company.
´With the validate button on record mode, Ranorex doesn't provide me the contents of a dataGridValues.
It is because i´m using the Trial version?
I need to validate the values of that DataGridValues one by one or exist any other option to do that?
I can validate that if the DataGrid has a certain number of lines and columms without using scripts?If not can you provide me an possible library to do that?
I have a litle hurry because at this time i need to choose which tool i'll use to the internship.
Best regards
email: [email protected] or [email protected]
Re: dataGrid Values validation
Use Ranorex Spy to see how the grid is recognized. From there you can write a little code to get the Grid object then you can use Grid.Rows or Grid.Columns to determine the number of rows and columns.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: dataGrid Values validation
Ciege can you show me an script example for validate if the dataGridValues has 24 rows and 2 columns please? I haved already read the User Guide chapter Code Actions, I know where i have to do the script but i'm having some problems to do that validation because i don't know how can i get the object named Table_datGridValues and validate the columns or rows.
i have this on UserCode
public static void Validate_Table_dataGridValues1()
{
//Your code here. Code inside this method will not be changed by the code generator.
Report.Info("Validating Exists on item 'FormTact_Chart_4_2_0_0.Table_dataGridValues'.");
//Validate.Exists(repo.FormTact_Chart_4_2_0_0.Table_dataGridValuesInfo);
for(_table_datagridvaluesInfo.Rows
}
Thanck you very much
i have this on UserCode
public static void Validate_Table_dataGridValues1()
{
//Your code here. Code inside this method will not be changed by the code generator.
Report.Info("Validating Exists on item 'FormTact_Chart_4_2_0_0.Table_dataGridValues'.");
//Validate.Exists(repo.FormTact_Chart_4_2_0_0.Table_dataGridValuesInfo);
for(_table_datagridvaluesInfo.Rows
}
Thanck you very much
Re: dataGrid Values validation
Here is a very brief example. With this example and with a valid table object you can iterate through the rows and output their data to the log. This should get you on the right path.
Code: Select all
try
{
foreach (Ranorex.Row row in RanorexTable.Rows)
{
Report.Info("Found row: " + row.Element.GetAttributeValue("AccessibleValue").ToString());
}
}
catch (Exception e)
{
Report.Error(e.ToString());
}
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: dataGrid Values validation
ciege ranorex launched a error when i implement that code, saying that RanorexTable doesn't exist
Re: dataGrid Values validation
Like I said you need a valid table object.
RanorexTable happens to be the variable name that I used for the table object.
Set RanorexTable to a valid table object using FindSingle or your preferred method of setting the object.
In the code below RanorexFormName is a valid form object that the table lives on. Make sure that is set or use Host.Local.FindSingle instead to search from the desktop.
RanorexTable happens to be the variable name that I used for the table object.
Set RanorexTable to a valid table object using FindSingle or your preferred method of setting the object.
In the code below RanorexFormName is a valid form object that the table lives on. Make sure that is set or use Host.Local.FindSingle instead to search from the desktop.
Code: Select all
Ranorex.Table RanorexTable = RanorexFormName.FindSingle(".//table[@controlname='" + strTableName + "' or @accessiblename='" + strTableName + "' ]", 60000);
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: dataGrid Values validation
Ciege i've tried several scritps for example "Code Examples"--> General and using the script above(working with 64bit win7)
// Call explorer.exe
System.Diagnostics.Process.Start("explorer.exe");
then i tried first with:
Form fileExplorer = Host.Local.FindChild<Ranorex.Form>("My Computer");
fileExplorer.Activate();
Button closeButton = fileExplorer.FindDescendant<Ranorex.Button>("Close");
closeButton.Click();
and second:
Form fileExplorer = "/form[@title='My Computer']";
fileExplorer.Activate();
Button closeButton = fileExplorer.FindSingle<Ranorex.Button>
("titlebar/button[@accessiblename='Close']");
closeButton.Click();
and the results were 5 errors on the first scritp(Cannot implicitly convert type 'Ranorex.Form' to 'System.Windows.Forms.Form' (CS0029),'Form' is an ambiguous reference between 'System.Windows.Forms.Form' and 'Ranorex.Form' (CS0104),'System.Windows.Forms.Form' does not contain a definition for 'FindDescendant' and no extension method 'FindDescendant' accepting a first argument of type 'System.Windows.Forms.Form' could be found (are you missing a using directive or an assembly reference?) (CS1061)....
on the second script others 5 errors,between (CS0029),(CS0104),CS1061,CS0069 and
Every time i tried to find a form those errors are showed. Can you explain to me whats the problem? I used the Ranorex Spy to find the title or the class name of the form i´m testing this moment and nothing solves the problem.
// Call explorer.exe
System.Diagnostics.Process.Start("explorer.exe");
then i tried first with:
Form fileExplorer = Host.Local.FindChild<Ranorex.Form>("My Computer");
fileExplorer.Activate();
Button closeButton = fileExplorer.FindDescendant<Ranorex.Button>("Close");
closeButton.Click();
and second:
Form fileExplorer = "/form[@title='My Computer']";
fileExplorer.Activate();
Button closeButton = fileExplorer.FindSingle<Ranorex.Button>
("titlebar/button[@accessiblename='Close']");
closeButton.Click();
and the results were 5 errors on the first scritp(Cannot implicitly convert type 'Ranorex.Form' to 'System.Windows.Forms.Form' (CS0029),'Form' is an ambiguous reference between 'System.Windows.Forms.Form' and 'Ranorex.Form' (CS0104),'System.Windows.Forms.Form' does not contain a definition for 'FindDescendant' and no extension method 'FindDescendant' accepting a first argument of type 'System.Windows.Forms.Form' could be found (are you missing a using directive or an assembly reference?) (CS1061)....
on the second script others 5 errors,between (CS0029),(CS0104),CS1061,CS0069 and
Every time i tried to find a form those errors are showed. Can you explain to me whats the problem? I used the Ranorex Spy to find the title or the class name of the form i´m testing this moment and nothing solves the problem.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: dataGrid Values validation
There are Form objects both in the System.Windows.Forms and the Ranorex namespace, and obviously you have "using" statements for both namespaces in your script. To correct the compiler error, you can either remove one of the "using" statements or qualify every usage of Form, e.g.:
Alex
Ranorex Support Team
Ranorex.Form fileExplorer = "/form[@title='My Computer']";Regards,
Alex
Ranorex Support Team
Re: dataGrid Values validation
Thank you very much ciege and support team help i finally get this result!
2010/04/09 14:46:24.806 INFO User Found row: 0:00
2010/04/09 14:46:24.816 INFO User Found row: 1:00
2010/04/09 14:46:24.836 INFO User Found row: 2:00
2010/04/09 14:46:24.836 INFO User Found row: 3:00
2010/04/09 14:46:24.856 INFO User Found row: 4:00
2010/04/09 14:46:24.876 INFO User Found row: 5:00
2010/04/09 14:46:24.896 INFO User Found row: 6:00
2010/04/09 14:46:24.906 INFO User Found row: 7:00
whith that script :
Report.Info("Validating columns and rows in datagrid'.");
Ranorex.Form tactform = ("/form[@controlname='TactChart']");
Ranorex.Table RanorexTable = tactform.FindSingle("/form[@controlname='TactChart']/container/container[@controlname='_togglePanel']/tabpagelist/tabpage[@controlname='_tabPageValues']/table[@controlname='_dataGridValues']");
try
{
foreach (Ranorex.Row row in RanorexTable.Rows)
{
Report.Info("Found row: " + row.Element.GetAttributeValue("AccessibleValue").ToString());
}
Report
}
catch (Exception e)
{
Report.Error(e.ToString());
}
Now i want to make the same to the columns count...but i´m using the same script to columns but the programm doesn't counting them...i only change rows to columns,i´m not seeing none error but the program shows Total Columns:0...can you say me why?
2010/04/09 14:46:24.806 INFO User Found row: 0:00
2010/04/09 14:46:24.816 INFO User Found row: 1:00
2010/04/09 14:46:24.836 INFO User Found row: 2:00
2010/04/09 14:46:24.836 INFO User Found row: 3:00
2010/04/09 14:46:24.856 INFO User Found row: 4:00
2010/04/09 14:46:24.876 INFO User Found row: 5:00
2010/04/09 14:46:24.896 INFO User Found row: 6:00
2010/04/09 14:46:24.906 INFO User Found row: 7:00
whith that script :
Report.Info("Validating columns and rows in datagrid'.");
Ranorex.Form tactform = ("/form[@controlname='TactChart']");
Ranorex.Table RanorexTable = tactform.FindSingle("/form[@controlname='TactChart']/container/container[@controlname='_togglePanel']/tabpagelist/tabpage[@controlname='_tabPageValues']/table[@controlname='_dataGridValues']");
try
{
foreach (Ranorex.Row row in RanorexTable.Rows)
{
Report.Info("Found row: " + row.Element.GetAttributeValue("AccessibleValue").ToString());
}
Report
}
catch (Exception e)
{
Report.Error(e.ToString());
}
Now i want to make the same to the columns count...but i´m using the same script to columns but the programm doesn't counting them...i only change rows to columns,i´m not seeing none error but the program shows Total Columns:0...can you say me why?
Re: dataGrid Values validation
So based on what you have leared so far (i.e. Table.Rows) think you can figure out the *Columns* part of it on your own?rj-nora wrote:Now i want to make the same to the columns count...but i´m using the same script to columns but the programm doesn't counting them...i only change rows to columns,i´m not seeing none error but the program shows Total Columns:0...can you say me why?
Another hint. Check the installed Ranorex API Documentation for Table.Rows and then check for Table.???

If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: dataGrid Values validation
Ciege i didn't understand your question i don't know the word "leared", at this moment i want to count Columns of my DataGrid like i did to count rows with your help,but nothing happens.Ciege wrote:So based on what you have leared so far (i.e. Table.Rows) think you can figure out the *Columns* part of it on your own?rj-nora wrote:Now i want to make the same to the columns count...but i´m using the same script to columns but the programm doesn't counting them...i only change rows to columns,i´m not seeing none error but the program shows Total Columns:0...can you say me why?
Another hint. Check the installed Ranorex API Documentation for Table.Rows and then check for Table.???
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: dataGrid Values validation
Maybe because there are no columns? Did you check if there are elements for the columns in Ranorex Spy? Ranorex tables do not support columns in all technologies, however, you can get the number of columns by counting the number of cells in the header row or first data row!rj-nora wrote: at this moment i want to count Columns of my DataGrid like i did to count rows with your help,but nothing happens.
Regards,
Alex
Ranorex Support Team
Re: dataGrid Values validation
Yes each row has 2 cells!i attached the screen shot of the datagrid..How can i use the loop foreach to count them? Using this methodthe Report info is Total Columns is :0. I need to see how many columns and rows exists..Support Team wrote:Maybe because there are no columns? Did you check if there are elements for the columns in Ranorex Spy? Ranorex tables do not support columns in all technologies, however, you can get the number of columns by counting the number of cells in the header row or first data row!rj-nora wrote: at this moment i want to count Columns of my DataGrid like i did to count rows with your help,but nothing happens.
Regards,
Alex
Ranorex Support Team
Ranorex.Form tactform = ("/form[@controlname='TactChart']");
Ranorex.Table RanorexTable = tactform.FindSingle("/form[@controlname='TactChart']/container/container[@controlname='_togglePanel']/tabpagelist/tabpage[@controlname='_tabPageValues']/table[@controlname='_dataGridValues']");
try
{
foreach (Ranorex.Row row in RanorexTable.Rows)
{
Report.Info("Found row: " + row.Element.GetAttributeValue("AccessibleValue").ToString());
}
Report
}
catch (Exception e)
{
Report.Error(e.ToString());
}
Last edited by rj-nora on Thu Apr 15, 2010 12:20 pm, edited 1 time in total.
Re: dataGrid Values validation
Sorry, typo... Learned is what I meant to say...rj-nora wrote:Ciege i didn't understand your question i don't know the word "leared", at this moment i want to count Columns of my DataGrid like i did to count rows with your help,but nothing happens.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: dataGrid Values validation
Try doing somthing like this....rj-nora wrote: Yes each row has 2 cells!i attached the screen shot of the datagrid..How can i use the loop foreach to count them? Using this methodthe Report info is Total Columns is :0. I need to see how many columns and rows exists..
Code: Select all
foreach (Ranorex.Cell cell in row.Cells)
{
Report.Info("Found cell: " + cell.Element.GetAttributeValue("AccessibleValue").ToString());
}
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...