How to identify records from a table in application

Ranorex Spy, Recorder, and Studio.
varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

How to identify records from a table in application

Post by varun » Tue Oct 09, 2012 1:43 pm

Hi Support,

In our application, saved records can viewed in form of table(shown in a grid). I want to click on edit link for those records in that table for which details are as per excel(Data source).

For instance,
Suppose, a Table is there in application with some records. And I want to click on Edit link for record in which Name is "Eqp" & Capacity is "580". How can i achieve this ? These details(Name & Capacity) are provided in Excel.

Thanks & Regards,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to identify records from a table in application

Post by Support Team » Wed Oct 10, 2012 10:12 am

Hi,

You have to use the right attributes for the repo item, where the "Name & Capacity" are contained and then you have to use repository variables instead of static values like described in the following UserGuide section: Lesson 3: Data-Driven Testing.

Regards,
Markus
Ranorex Support Team
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Wed Oct 10, 2012 1:03 pm

Hi Markus,

Thanks for your response and referred link:!:

I already gone through this link. As far I know, Repository variables are created/used for mouse clicks and keystrokes. Correct me if I am wrong !
But in this case, we just have to read the value from application and excel, and then compare them. If records matched, then cursor should click on Edit link. But if I do multiple clicks anywhere in application to bind repository variables with Name & Capacity then how could we use them to compare values ? Please throw some light on this. I am attaching snapshot for your reference to better understand this problem.
Also, let me know which attributes would be help-full for use to achieve this task ?

Thanks & Regards,
Varun.
Attachments
Edit_Records.png
Excel & Application Snapshot
Edit_Records.png (32.14 KiB) Viewed 1240 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to identify records from a table in application

Post by Support Team » Thu Oct 11, 2012 9:54 am

Hi...
varun wrote:As far I know, Repository variables are created/used for mouse clicks and keystrokes. Correct me if I am wrong !
Basically, repo variables are use to identify UI objects based on data driven inputs.
After identifying the objects, you can operate on them (click, keystroke, validation, etc.).

In your case I would recommend to specify the RanoreXPath of the edit button including the cells you want to validate.

The RanoreXPath might look something like the following (starting from the table you are working with):
tr/td[@innertext=$name]/following-sibling::td[@innertext=$capacity]/following-sibling::td/input
This RanoreXPath is trying to identify a row holding a cell with the value stored in the variable '$name'.
From this cell the RXPAth is trying to find a following sibling cell holding the value stored in the variable '$capacity'. And outgoing form this cell the RXPath tries to find the Following sibling cell holding the button.

For further details please have a look at following references:
http://www.ranorex.com/support/user-gui ... xpath.html
http://www.ranorex.com/support/user-gui ... ditor.html
http://www.ranorex.com/blog/ranorexpath-tips-and-tricks

Regards,
Tobias
Ranorex Team
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Mon Oct 15, 2012 1:33 pm

Hello Tobias,

Thanks for your response for my Queries and links provided.

I've successfully made RX to identify the records in application but now it's not clicking on corresponding Edit link button. For e.x, RX is able to identify record 'Normandie' but not able to click on its Edit link[see prior attached snapshot].
So kindly let me know how to make RX to click on this link when required.

Thanks & Regards,
Varun.

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Wed Oct 17, 2012 5:19 am

PFA snapshot for the method I applied to identify record from application. Now hurdle is, how to make RX to click on Edit link for this record(see snapshot attached in previous replies).
Please guide.

Thanks,
Varun.
Attachments
TryDel_Repo.png
TryDel_Repo
TryDel_Repo.png (91.8 KiB) Viewed 1204 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to identify records from a table in application

Post by Support Team » Wed Oct 17, 2012 11:43 am

Hi,

as explained in my last post you have to define the input based on the cell you know the attribute 'innertext'.
So the RanoreXPath to the specific input might look something like the following:
//table/*/tr/td[innertext='$vardeletename']/following-sibling::td/following-sibling::td/input
Regards,
Tobias
Ranorex Team
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Wed Oct 17, 2012 1:31 pm

Hi,

Thanks Tobias, this solves our purpose. :D
Will let you know if in future stuck any where in scripting.

Thanks,
Varun.

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Mon Oct 22, 2012 11:04 am

Hi Support,

I have a scenario, in which first I have to click on edit link of Group and then it's records. See attached "EditSteps_1022.png", Step 1 clicks on Edit link of Group and Step 2 clicks on Edit link of record.
Clicking on Edit link of Group navigates to detail page, consisting of all records in it(See attached "Edit1_1022.png"). And here, RX should click on Edit link of a related record(as provided in data source). But afraid to say, it's not working as desired.

Please look into it and kindly let me know what need to be change in logic??

Thanks in advance!

WR,
Varun.
Attachments
EditSteps_1022.png
EditSteps
EditSteps_1022.png (124.5 KiB) Viewed 1186 times
Edit1_1022.png
Edit1
Edit1_1022.png (41.45 KiB) Viewed 1186 times

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Mon Oct 22, 2012 11:44 am

Forgot to attach Error Log, PFA FYI.

Thanks.
Attachments
ErrorLog_1022.png
ErrorLog_1022
ErrorLog_1022.png (94.52 KiB) Viewed 1185 times

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Mon Oct 22, 2012 1:35 pm

Hi Support,

Glad to say that I have done with it.

Thanks for your kindness.

Regards,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to identify records from a table in application

Post by Support Team » Mon Oct 22, 2012 3:19 pm

Hello Varun,

Thank you for the information.

Regards,
Bernhard
Ranorex Support Team
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Tue Oct 23, 2012 1:48 pm

Hi Bernhard,

Web page of application has Groups and in Groups there are records. If groups are opened then we are navigated to Records page which are within it.
Case is->
Now I have to delete the group, and before deletion I have to confirm if any record is available within it or not. If Yes, then click on Edit link of Group and delete all records in it. Save the changes then click on delete link of group.

As click on Edit/Delete link is done through Repo so I want to know how can this be controlled by scripting so that I can apply condition on it, like this-
if GroupRecordsCount > 0 then click on Edit link of Group
{
Delete records until count = 0;
}
else
click on Delete link of Group;

To get the idea of page, please check snapshot "Edit1_1022.png" attached with earlier post.
Suggestions appreciated.

Thanks & Regards,
Varun.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to identify records from a table in application

Post by Support Team » Wed Oct 24, 2012 1:59 pm

Hello Varun,

The following example shows how you could delete tags:

IList<InputTag> tags = webDocument.FindDescendants<InputTag>();
foreach (InputTag inputTag in tags)
{
// delete record
}
// delete group

Regards,
Markus (T)
Ranorex Support Team
.
Image

varun
Posts: 110
Joined: Mon Jul 23, 2012 5:52 am

Re: How to identify records from a table in application

Post by varun » Fri Oct 26, 2012 7:47 am

Hello Markus,

Can you please tell me what "tag" refers to, is it a keyword or should I pass it as Array ??
Below I am providing with more details on this-

I am using excel as data source with values in two columns, one for identifying Group name and second for Records of Group. Its not mandatory that every group has records in it. If Group is without any record then simply click on delete link of Group but If records are available in a Group then steps will be-
1. Click on Edit link of Group.
2. Delete all records of Group by click on Delete link of records on by one. Note: Delete confirmation message will appear for each & every record.
3. Click on Save button.
4. Click on Delete link of Group, and click Yes when delete confirmation message appears.
5. Continue from Step 1 if more groups are provided in excel to delete.

I have define Repo variables to pass value of Group and its records from data source but problem I am facing is-
See attachment "DeleteSteps_1026.png" and "ExcelRecords.png".
a) I have bind Repo Variables of Step1 (to click on Edit link) which binds with Group Name column of data source(Yellow highlighted in "DeleteSteps_1026.png"). And as of RX limitation we can't bind one variable with two columns. So what I should do to tell RX that on which delete link(to delete the group) it should click(Blue highlighted in "DeleteSteps_1026.png")?
b) How to drive RX to keep on deleting records until they are finished or until all entries are processed from excel against it. And then click on Save button.

Let me know if required more clarification. Your response awaited.

Thanks & Regards,
Varun.
Attachments
ExcelRecords_1026.png
Data Source Records
ExcelRecords_1026.png (5.6 KiB) Viewed 1152 times
DeleteSteps_1026.png
Deletion Steps
DeleteSteps_1026.png (106.06 KiB) Viewed 1152 times