QTP - QTP SwfObject (676 Views)
Reply
Occasional Advisor
DParker
Posts: 11
Registered: ‎04-17-2008
Message 1 of 31 (676 Views)

QTP - QTP SwfObject

I am pretty familiar with TSL but am not too up on QTP. However we are rewriting the Powerbuilder app that WR was used for in a DOT net environment. I have done a bit of VB scripting but not w QTP. I see that with the SwfComboBox I can get a row count (GetItemsCount) and the values (GetItem(i)). Is there a way to get a row count for a DataGrid - it records the object as SwfObject("iGrid4"). Apparently that object does not have a GetItemsCount or GetItem method. There is a GetTOProperties and GetROProperty but it does not appear that the properties include a row count, or item values.

The docs dont seem very clear about this, anyone have any info?
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 2 of 31 (676 Views)

Re: QTP - QTP SwfObject

Can you post a screenshot of Object Spy showing the properties it can see while spying on the grid? I am especially interested in its nativeclass / swfname / swftypename / swfname path etc values.
Please use plain text.
Occasional Advisor
DParker
Posts: 11
Registered: ‎04-17-2008
Message 3 of 31 (676 Views)

Re: QTP - QTP SwfObject

OK I suppose this makes a differnce. The developer tells me that this is not a standard Visual Studio control, but one purchased from TenTec. Called iGrid.

Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 4 of 31 (676 Views)

Re: QTP - QTP SwfObject

Yes, it is a custom grid. With .NET grids such as this, the best way is to go about using the native (.NET) properties and methods to get what you need. These properties and methods can be accessed by using the .Object on your test object for the grid.
Refer to the documentation on that .NET grid available under download section at http://www.10tec.com/Home/Download/index.aspx.

For example: to get rowcount, you would probably do something like:
Print "Number of rows = "& SwfWindow("yourMainWindow").SwfObject("iGrid4").Object.RowCount
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 5 of 31 (676 Views)

Re: QTP - QTP SwfObject

Hi Krishna Garu,

I have come across your profile on HP quality center. I have been having issues with the grid in QTP.Please can you look at these errors and let me know if you have any solutions.

Thank you for the help. I have attached a zip files for the two errors I have been having with the application pricer.

1st error: "Cannot identify the object "WC1xxGrid" (of class WbfUltraGrid). Verify that this object's properties match an object currently displayed in your application."

In the attachment I have included the object properties screenshot and spy object screen shots. Also I have included the screen shot of the application pricer where I am getting this error.

2nd error: "object disabled error" and "Cannot identify the specified item of the select object"

In the attachment(find_a_person_app_error) I have included the

1) findaperson_dialog_box.bmp- Screen shot of application
2) findaperson_error.bmp- error message
3) findaperson_errorlines.bmp- errors line number and active screen shot
4) application_script_screenshot1.bmp and application_script_screenshot2.bmp- where I am getting the error and the application in the active screen.
5) object_disabled_error.bmp- Screen shot of object disabled error.

I'm having problem with an application "find a person" which is used by most of the application here at the company. When I record a script, the script does not run at the point where I recorded "find a person" application. I think because the application is dynamic, I just need to type the first few letters of the last name and it automatically gives me a drop down list of people matching the few letters I entered. Just like gmail when we enter the first few letters of an email ID, when we are composing a mail it gives a list of people we can choose from and we select one but QTP does not recognize this. I have tried using low level recording; Object repository; Smart identification mechanism but these don't work either. Please do let me know if you have a solution. The first three snapshots are the "find a person application dialog box errors".

Please let me know if you have any questions.

--
Arthi
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 6 of 31 (676 Views)

Re: QTP - QTP SwfObject

Aarthi,
didn't have time to go through everything, but it looks like you are going through typical issues found in pure record & replay use of QTP.
Referring to the grid issue:
I don't see any .Sync statements. Can you add Browser("yourBrowser").Page("yourPage").Sync before every statement that is causing object not found error for the grid(s) and try again?
Issue2:
you can type using sendkeys and I will post that separately. Do not use Set in the webedit. SendKeys should cause the list to open up.
Try so far and let me know how things go.
You can address me as Krishna, no need for Krishna Garu. Thanks.
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 7 of 31 (679 Views)

Re: QTP - QTP SwfObject

Set WshShell = CreateObject("WScript.Shell")
Browser("projectPricer").Window("Find person dialog -").Page("Find person dialog").WebEdit("text1").Click
WshShell.SendKeys("ti")
Set WshShell = Nothing
Wait 2
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 8 of 31 (679 Views)

Re: QTP - QTP SwfObject

Thank you, Krishna for the solutions will let you know how they workout. Yeah I know thatâ s a lot to read but I just wanted to clarify the errors I have been having. I thought the more information I gave the more it will help in understanding the errors. Anyway ,I appreciate your help.

Arthi
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 9 of 31 (679 Views)

Re: QTP - QTP SwfObject

Krishna,

Do I add these statements:

"Set WshShell = CreateObject("WScript.Shell")
Browser("projectPricer").Window("Find person dialog -").Page("Find person dialog").WebEdit("text1").Click
WshShell.SendKeys("ti")
Set WshShell = Nothing
Wait 2"

Instead of the statement that is producing the error or do I add it just before the error statement? Also referring to the grid error I have tried the exist statement according to help in QTP but it did not help. Does the sync statement work different then exist statement?
For example: exist statements for ->
Browser (â yahoo!). page(â yahoo!â ).Link (â Arts & humanities â ). Click
----
Msgbox Browser (â yahoo!).Exist
Msgbox Browser (â yahoo!).page(â yahoo!â ).Exist
Msgbox Browser (â yahoo!). page(â yahoo!â ).Link (â Arts & humanities â ). Exist

Thank you
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 10 of 31 (679 Views)

Re: QTP - QTP SwfObject

Kindof gibberish,sorry about that.Here is what I wanted to post.

For example: exist statements for ->
Browser ("yahoo!"). page("yahoo!").Link ("Arts & humanities "). Click
----
Msgbox Browser ("yahoo!").Exist
Msgbox Browser ("yahoo!").page("yahoo!").Exist
Msgbox Browser ("yahoo!"). page("yahoo!").Link ("Arts & humanities").Exist

thank you
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 11 of 31 (677 Views)

Re: QTP - QTP SwfObject

Arthi,
exist is not necessary here. Sync will help QTP wait for the page navigation to be completed after you performed some operation on something that causes a change to that page.
Browser ("yahoo!".page("yahoo!").sync
If that doesn't help, you can even use a statement like
Wait 3
for example, to wait for 3 seconds between the end of an operation and the beginning of the next.

You need to get rid of the statement that does .Set on the web edit field. I can't copy and paste the lines from your bitmap, so if you post those actual code lines as text, I can show you how they should look like while using SendKeys.
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 12 of 31 (677 Views)

Re: QTP - QTP SwfObject

I will post the code this evening because someone else is using QTP and I cannot access QTP until they are done with there work.Thank for the help krishna .I was so confused as i was not able to solve the errors.I am new to QTP.

Thanks again
Arthi
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 13 of 31 (677 Views)

Re: QTP - QTP SwfObject

Krishna,

I have included the script and the snapshot of the error in the attactment.please could show me how the sendkeys should look like and why i am getting this "Cannot identify the object "WC2xxGrid" (of class WbfUltraGrid). Verify that this object's properties match an object currently displayed in your application." ???????

Thank you very much
Arthi
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 14 of 31 (677 Views)

Re: QTP - QTP SwfObject

Krishna,

I have included the script and the snapshot of the error in the attactment.please could show me how the Sync should look like and why i am getting this "Cannot identify the object "WC2xxGrid" (of class WbfUltraGrid). Verify that this object's properties match an object currently displayed in your application." ???????

Thank you very much
Arthi
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 15 of 31 (677 Views)

Re: QTP - QTP SwfObject

Krishna,

i add sync to the script before the error statment but it did not help below is the script

'pricing scenario
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WG1").SelectCell "0","SCENARIO"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WebEdit("WebEdit").Set "Test1"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WC1xxGrid").SelectCell "1","DESCRIPTION"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WebEdit("WebEdit").Set "raw labor"
Browser("Pricer Grid Page").Page("Pricer Grid Page").Sync
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WC2xxGrid").SelectCell "8","ORACLE_BILLING_METHOD_DESCRIPTION"' <- error line
wait(3)
Browser("Pricer Grid Page").Page("Pricer Grid Page").WebButton("Add Row").Click
Browser("Pricer Grid Page").Page("Pricer Grid Page").WebEdit("WebEdit").Set "Test2"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WC1xxGrid").SelectCell "0","DESCRIPTION"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WG1").SelectCell "1","DESCRIPTION"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WebEdit("WebEdit").Set "perdiem"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WC2xxGrid").SelectCell "5","ORACLE_BILLING_METHOD_DESCRIPTION"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WG1").SelectCell "1","DESCRIPTION"

thank you
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 16 of 31 (677 Views)

Re: QTP - QTP SwfObject

Hi Krishna,

Thank you so much; with your help I was able to fix the 2nd issue. Please if you can help with the 1st issue I would be so grateful to you. I did post/attach the script and the snapshot for the 1st issue as you asked me to.

Thanks again
Have a great day :)
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 17 of 31 (677 Views)

Re: QTP - QTP SwfObject

Lets try this. I am assuming you can not see the grid manually either when QTP script says it cannot be found. If that is the case, sync and wait statements will help before trying to do anything with the object that cannot be found.
If that is not the case and you can see the grid manually at that point, see if the object gets "highlighted" when you click on the highlight button in your object repository (OR). I am guessing it doesn't, which means its properties have changed. Relearn the object at that point to see what has changed and change your object description in OR accordingly. Actually, there are several ways to address your whole approach, but given your knowledge of QTP, and the fact that you are dependent on Record and Replay, what I suggest is that you upgrade to QTP 9.5, which has a new feature called Maintenance Run mode, which will help you in situations like this. In the end, you will need to play with your application (after carefully going through user guide and trying out various things) and fix it yourself for people on the forum don't have access to it. We can only guide you on some things to try based on our own experience. Just so you know things like this are a common occurrence in gui automation and when you figure it out yourself after you go through all the documentation, you will learn much more.
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 18 of 31 (677 Views)

Re: QTP - QTP SwfObject

Hi Krishna,

Thank you for the reply but yesterday I did try to add the sync and wait statements, they don't seem to work, I still get the errors although I don't know if I placed the statements in the right order. I am asking for you help because this project is due in a week and I am having these 2 issues with it that should be solved ASAP as no one else here knows QTP here in my team so I am solely responsible and if I have any questions also I cannot ask anyone. Please do let me know how to solve the grid issue. I sent the code where I am getting the error. Also right now I cannot upgrade to 9.5 as I have only a week to submit this project.

Thank you so much
Arthi
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 19 of 31 (677 Views)

Re: QTP - QTP SwfObject

You did not address whether you are able to see the grid when QTP says it cannot find it. The solution depends on what actually happens when QTP says it cannot see it. Is the grid really there at that point and QTP is just not able to see it Or
has the grid not appeared yet at that point, so QTP is right in saying that it is not there?
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 20 of 31 (677 Views)

Re: QTP - QTP SwfObject

Krishna,

The grid is a drop down list when we choose one of the options from the drop down list it records it as "WC2xxGrid" unless we click on the button to see the drop down we cannot see the grid. Also after I run the script and go to OR and try to highlight the "WC2xxGrid" it does not get highlighted. I have included a snapshot of the application where the "WC2xxGrid" appears. Do let me know if you need anymore information.

Thank you
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 21 of 31 (677 Views)

Re: QTP - QTP SwfObject

What is in the code that is clicking on the button to open up that list or grid?
Here are your lines.
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WC1xxGrid").SelectCell "1","DESCRIPTION"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WebEdit("WebEdit").Set "raw labor"
Browser("Pricer Grid Page").Page("Pricer Grid Page").WbfUltraGrid("WC2xxGrid").SelectCell "8","ORACLE_BILLING_METHOD_DESCRIPTION" ' <- error line

There is no image that shows that steps 1 and 2 above are performed. Step 3 is causing you the error so I would assume at the end of step 2, I should see "raw labor" set as input into some web edit. Where is the image of that and where is the code that would cause the list to open up in the first place?
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 22 of 31 (677 Views)

Re: QTP - QTP SwfObject

You are right,I was trying to not click the side button as it gives me error and just selecting by clicking in the box.You can either click the button to open the drop down or click on the box to open the dropdown list.I can send you the code of with the image if that would be more useful.
Please use plain text.
Honored Contributor
Krishna Kolachalama
Posts: 648
Registered: ‎01-29-2008
Message 23 of 31 (677 Views)

Re: QTP - QTP SwfObject

You have to include code that contains all of the actions that you perform to make the list/grid open up. If some step is not recorded even though you performed the actions, you have to identify that first and rectify it. Re-record it if you have to.

In one of your bitmaps, I see a task bar item that says "QTP interview questi...". I hope all this is not from some interview. I cannot help you if it is so. Please clarify.
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 24 of 31 (677 Views)

Re: QTP - QTP SwfObject

No krishna,I work at a company,i started working here 1month back.I was using the interview question for learn how to relearn the object properties as you mentioned in one of the replies this morning.

Also I attached the script with image in it.
Q: Why is that when I record the script and run immediately without refreshing the page I don't get the grid error and it's recognized but when I refresh the page and then run it,it does not recognize the grid?

thank you
Please use plain text.
Frequent Advisor
QA_Testing
Posts: 40
Registered: ‎05-15-2008
Message 25 of 31 (677 Views)

Re: QTP - QTP SwfObject

Here is the error again. It is able to recognize "WC1xxGrid" but not "WC2xxGrid" why is that?
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation