Micro Focus QTP (UFT) Forums

Full Version: GetROProperty returns unexpected value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi!
I have a next question. I'd like to get an dynamic value from a webpage and then place it in in a serch field. So I am using the next:
Code:
UW_nummer = DataTable("UW_nummer", Global)=Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("FORMFRAME").WebElement("htmlTag:=TD","abs_x:=2097","abs_y:=389").GetROProperty("outertext")
msgbox UW_nummer
Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("leftFrame").WebEdit("WebEdit").Set UW_nummer
I am expecting then the value that is shown at this time in that webelement. But the search field is filled with the value "False" instead. It seams that QTP dont see the value in this elemen.
I've tryed also the next: GetROProperty("innertext"); WebTable instead WebElement, but result is still the same. I send some screenshots of situation.

Thanx.
Hi Oleg,

Never use co-ordinates as a description for your object.

Please add the object to Reporsitory and use regular expression.. finally u can use the below code..

Code:
'Get the value
UW_Number=Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("FORMFRAME").WebElement(<Name of the Object addedd to repository>).GetROProperty("innertext")

'Set the value
Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("leftFrame").WebEdit("WebEdit").Set UW_Number

Do let me know if u have any query.

Regards,
Ankesh
Try this,
Code:
UW_nummer = DataTable("UW_nummer", Global)=Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("FORMFRAME").WebElement("htmlTag:=NOBR","abs_x:=2102","abs_y:=389").GetROProperty("outertext")
msgbox UW_nummer
Regards,
Ravi
Hi Ankesh,

Thank you for your reaction.
That is what I done:
1. Used WebTable instead of WebElement.
2. Changed the coordinates. I have to use them because the name of the element is not unique.
3. Changed 'outertext" to "innertext".
The result is still the same.

Thanks for your reaction as well, Ravi.Gju. Unfortunately it did not work either.

This is the code I am trying to use now:
Code:
    UW_nummer = DataTable("UW_nummer", Global)=Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("FORMFRAME").WebTable("htmlTag:=TABLE","abs_x:=1918","abs_y:=363").GetROProperty("innertext")  
    msgbox UW_nummer
And this is the result (see the screen with mesgbox).
Please look at the Run screen shoot as well (Onwaar = False in Dutch language Smile ). What is also funny - in the search field I am getting value False - in English!
May be you have other suggestions?
Hi,

Try this :
Code:
Set oDesc=Description.Create()
oDesc("micclass").value="WebTable"
oDesc("class").value="repeatReadOnly"

Set objColl=Browser().Page().Frame().ChildObjects(oDesc)

cnt_tb=objColl.count

For i=1 to cnt_tb
    no_cols=objColl.item(i).getroproperty("cols")
    If no_cols=2 Then
         data_tab=objColl.item(i).getcelldata(<row no>,<put here the column number in which ur data appear>)
        msgbox data_tab
    End If
Next
Thank your for your help, parminderdhiman84.

I did as you advised:
Code:
Set oDesc=Description.Create()
oDesc("micclass").value="WebTable"
oDesc("class").value="repeatReadOnly"
Set objColl=Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("FORMFRAME").ChildObjects(oDesc)

cnt_tb=objColl.count
For i=1 to cnt_tb
no_cols=objColl.item(i).getroproperty("cols")
If no_cols=2 Then
data_tab=objColl.item(i).getcelldata(3,2)
msgbox data_tab
End If
Next
Unfortunately I've get an error message (see screenshot).
Probably I did something wrong...

Hi,

Please try replacing the above For Loop with one of the following for loops. One of them should work for u:

Code:
For i=0 to cnt_tb-1
no_cols=objColl.item(i).getroproperty("cols")
If no_cols=2 Then
data_tab=objColl.item(i).getcelldata(3,2)
msgbox data_tab
End If
Next

or
Code:
For i=0 to cnt_tb-1
no_cols=objColl(i).getroproperty("cols")
If no_cols=2 Then
data_tab=objColl(i).getcelldata(3,2)
msgbox data_tab
End If
Next

or

Code:
For i=1 to cnt_tb
no_cols=objColl(i).getroproperty("cols")
If no_cols=2 Then
data_tab=objColl(i).getcelldata(3,2)
msgbox data_tab
End If
Next

If still the error comes then could u debug to check that "cnt_tb" is returning any value or not.
Code:
Set oDesc=Description.Create()
oDesc("micclass").value="WebTable"
oDesc("class").value="repeatReadOnly"
Set objColl=Browser("PegaRULES Process Commander").Page("PegaRULES Process Commander").Frame("FORMFRAME").ChildObjects(oDesc)

cnt_tb=objColl.count
If (cnt_tb > 0) Then 'checking to see if the objColl.count > 0
  For i=1 to cnt_tb
    no_cols=objColl.item(i).getroproperty("cols")
    If no_cols=2 Then
      data_tab=objColl.item(i).getcelldata(3,2)
      msgbox data_tab
    End If
Next
End If

Try by adding other properties :
Code:
oDesc(<other property>).value=<property value>

till you get cnt_tb > 0 i.e. objColl.count > 0
Thanx a lot, parminderdhiman84!

It works perfect now.
I used the first loop, only changing the row number.

Code:
For i=0 to cnt_tb-1
no_cols=objColl.item(i).getroproperty("cols")
If no_cols=2 Then
data_tab=objColl.item(i).getcelldata([b]2[/b],2)
msgbox data_tab
End If
Next

You saved my day Smile .
Hi parminderdhiman84.

Any idea as to why it was giving "onwaar" as the output.

Regards,
Ravi
Pages: 1 2