Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QTP throws error on web elements when Descriptive programing used.
#1
Not Solved
If I record in QTP-10 for clicking on a web tab page I am getting the below type of code.
Code:
Browser("Works Information Management").Page("Works Information Management").Frame("Frame").Link("Cost Estimate").Click

But Frame is Dynamic & name changes always as Frame_1, Frame _2….etc.

I changed the code as below using Spy
Code:
Browser("title:=Works Information Management System").Page("title:=Works Information Management System").Frame("micclass:=Frame").Link("title:=Cost Estimate").Click

I am getting error while executing.

I even tried below code:
Code:
Browser("title:=Works Information Management System").page("title:=Works Information Management System").Frame("micclass:=Frame").webtable("column names:=Add New Work;").Link("innertext:=Cost Estimate").WebElement("innerhtml:=Cost Estimate").Click

I am attaching the error Screen Shot & Spy screen

Please help me ASAP.


Attached Files Image(s)
   
Reply
#2
Not Solved
Hi Ramesh,

Try this script once, please let me know if you get any errors.
Code:
set desc=Description.create()
desc("micclass").value="WebTable"
desc("name").value="Add New Work"    ' Edit here if name is different
'Add more values incase if exists for the table

Set WebEdits=Browser("title:=Works Information Management System").page("title:=Works Information Management System").ChildObjects(desc)
rCount=WebEdits(0).rowCount
'WebEdits(0) here 0 is used to access the first webtable, change it if  different table
For r=1 To rCount-1
    cCount=WebEdits(0).columnCount(r)
    For c=1 To cCount-1
        oCount=WebEdits(0).ChildItemCount(r,c,"Link")
        obj=1 To oCount-1
        If (StrComp(WebEdits(0).ChildItem(r,c,"Link",obj).GetROProperty("innertext"),"Cost Estimate")=0) Then
            WebEdits(0).ChildItem(r,c,"Link",obj).Click
        End If
    Next
Next
Reply
#3
Not Solved
Hi Ramesh,

For this problem, you can try catching the changing rule of the frame name, and use regular expression for it. For example:

You can use this regular expression: ^Frame_\d+$ to match these frame names:
Frame_1
Frame_2
Frame_9999999
...

Regards,
Ngoc Vo
Reply
#4
Not Solved
Hi Kavita,
The solution is not working as it is displaying syntax error. Also I am new to QTP. Actually it is a web tab page not a link. Also I am having same Issue in the Cost Estimate page which contains an Image and it's name changes continuously. I parametrized as mentioned above but it is not working.

I am also attaching the code for this.

Code:
Browser("Works Information Management").Page("Works Information Management").Frame("Frame").Link("Cost Estimate").Click
Browser("Works Information Management").Page("Works Information Management").Frame("Frame_2").Image("javascript:OpenEstimate(8770,1").Click

It changed from Image("javascript:OpenEstimate(8770,1") to Image("^javascript:OpenEstimate(\d+$")

After parametrization in Object Repository the code changed automatically but not working.
I even tried Image("javascript:OpenEstimate(.*")

I turn on smart identification also before running the script.
Please help me.


Attached Files Image(s)
   
Reply
#5
Not Solved
Can Anybody help me for my situation
Reply
#6
Not Solved
Hi
Can you please check if the Frame has any unique property such as a name/title or any value in the innertext or innerhtml that you can use for handling the dynamic frame. Look for unique properties on both Identification/Native properties secton of the Object Spy.

Thanks
MV
Reply
#7
Not Solved
I am attaching the screen shot for my problem. Also i am attaching the Object spy screen shot.
Please help me In this regard.


Attached Files Image(s)
   
Reply
#8
Not Solved
Hi,

Use filename and index property to identify your image object and for frame use html tag, html id, title if these are not changing.
Reply
#9
Not Solved
HI,
The file name property didn't worked as 2 similar Icons present in the page. I am also not found Index property in the Spy.

Please help me on this.

I found another solution for the problem but i don't have idea on doing this. Need Help on this.
I can get the value (8770,1) from database query ==> ("javascript:OpenEstimate(8770,1")

My Situation is as below
first i have to get a value from Text Box 'x/xxx/xxxx' and i have to store some where, I am storing that in data table or i can store in a variable (ExTongue) ==> This i achieved and i am able to store the value in variable p or in datatable.

Later on I have to fire a query in the database and should pass the value in to Query => Select ID, NumID from Costestimate where ReqID= 'P'
Then i can get the value => (8770,1)
Then i have to do descriptive programming to click on the Yellow Icon.
Please help me on my Situation. By providing the code. My database is SQLServer

I Don't know how to do but i tried this after that please help me

Code:
Dim MyConnection, ConnectionString
Set MyConnection = CreateObject("ADODB.Connection")
ConnectionString = Provider=sqloledb; Data Source=Ramesh; Initial Catalog=ProdDB;User Id=sa;Password=sa@123
Set MyRecordSet = CreateObject("ADODB.Recordset")
MyRecordSet.Open "Select ID, NumID from Costestimate where ReqID= 'P' "

But how can i pass P(value) in to that Query
and i have to get the Database query result in to the QTP application
and i have to concatenate the rest of the string(javascript:OpenEstimate) to that value,
Then i have to click on the Yellow Icon
Reply
#10
Not Solved
q="Select ID, NumID from Costestimate where ReqID= '"&p&"'"

MyRecordSet.Open q
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Descriptive programing kedala 1 2,709 10-04-2016, 09:25 PM
Last Post: venkatesh9032
Smile find out of spelling error in Web application deveshbhatt29 1 2,172 01-10-2014, 05:10 PM
Last Post: Maheep_bhambri
  Getting an 'Error in XML document' Error when submitting web services XML luckyexpert 0 3,095 08-20-2013, 10:23 PM
Last Post: luckyexpert
  Web Table Descriptive Language karraaruna 3 3,448 07-04-2013, 08:06 PM
Last Post: karraaruna
  Web Elements DL karraaruna 3 3,177 06-06-2013, 10:05 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 3 Guest(s)