Dynamic webtables in folderframe: First Counting and then Editing: Not working
I have a issue where I am really stuck up. I have tried a lot. I am going to share my code and need your advise.
Please see the attachment for better picture.
I have a screen called application For Unemployment Benefits - Page 6
Functionality - Based on user work history, application will populate one, two or multiple employers.
By default, there will be one employer
Scenario 1: If there is only one employer, my script will simply fill in detail and works perfect.
Challenge - However, I/my script don't know, how many employers going to be? My script fails since I have not written script for additional employer frames.
I need to write a script so that my scripts perform following
1. To find out number of employers available
2. Write a For loop to select each employer and enter in detail
I need your help doing step 1, finding Employer count
My code is as below
Dim Employers 'Declare an object variable
Set Employers = Description.Create 'Create an empty description
Employers("Class Name").Value = "WebElement"
Employers("class").Value = "textData"
Employers("html tag").Value = "TD"
Set Numbers = Browser("Nebraska Department of").Page("Nebraska Department of").Frame("folderFrame_10").WebTable("Employers Name").ChildObjects(Employers)
MsgBox "Number of Employers" & Numbers.Count
The result after executing line was 0
Does it mean that my script did not find number of employers?
Last edited by JwalantBhatt0602; 02-29-2016 at 10:38 AM.
The answer to your question is no.
Originally Posted by JwalantBhatt0602
The ChildObjects method does not return the number of matching objects, it returns the matching objects themselves.
If Numbers.Count returns 0 THEN it didn't find any.
From the UFT (built in) help document - which also includes examples, including using the .count method:
Returns the collection of child objects contained within the object.
•The method returns the child objects that fit the description specified (using the Properties object).
•When an object is retrieved by the ChildObjects method, UFT accesses it directly in the application and does not save a description for the object. Therefore, you must use the object immediately after retrieving it, and before anything in the application changes.
•The ChildObjects method is not supported for Insight objects.
... just another Tester ...
Originally Posted by a.irvine
Thank you my friend. You gave me good direction. I still need help because I am unable to write script based on my knowledge. I know that there will be scenario where I may have 3-4 employers. How would I write my script to handle.
1. I know that first I have to find out how many are there
2. Then, I can use For loop to cover multiple employers.
What is the parent object of the employer details, is it a unique frame for each employer?
As an alternative to scraping the GUI for clues to how many employers there are, can you query the back-end? I'm assuming there's a database hiding behind this application. Does it contain the number of employers for a given employee? Can you get access to it? If it's not stored in a database then it is likely the result of a web API of some sort. Could you hit that API directly for the information?
If you look into the attachment, there is a Frame, under the Frame, there is Big Web Table. Under that Big WebTable, there can be multiple Webtables (one webtable per employer) are arranged.
Originally Posted by mwsrosso
Answer to you question is WebTable.
Well, let me explain what I am doing.
I am given 15-20 test data (SSNs) which we get from our production environment. That particular SSN may have worked with only one employer or multiple employer. So I have to write a script that should handle multiple employer as well.
So in given 15-20 SSNs, some of them may have one, two or more employers. Even if I access to that information, I still have to write a script to handle that.
I hope I have answered your question.
Thank you for your time and feeback. Really appreciated.