Micro Focus QTP (UFT) Forums
descriptive programming setting a value in a WebEdit table. - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: descriptive programming setting a value in a WebEdit table. (/Thread-descriptive-programming-setting-a-value-in-a-WebEdit-table)



descriptive programming setting a value in a WebEdit table. - mark spurny - 11-12-2010

First inquiry to a forum -- ever --> be kind...

I am trying to use descriptive programming to set a value inside of a table. I am using QTP 8.2 and our company is not planning on upgrading (insert groaning noise here). When I run QTP here is my error message:

Cannot identify the object "WebEdit" (of class WebEdit). Verify that this object's properties match an object currently displayed in your application.

Here is my code using "DP" which does not work.
Code:
Browser("name:=Field Activity").Page("title:=Field Activity").Frame("name:=FA_TYPE_CHAR").WebEdit("name:=FA_CHAR:0$CHAR_VAL").Set "FLOODCHK"


Here is the code when I recorded the action(this works well):
Code:
Browser("Field Activity").Page("Field Activity_2").Frame("FA_TYPE_CHAR").WebEdit("FA_CHAR:0$CHAR_VAL").Set "FLOODCHK"




I even tried to further clarify by adding the WebTable to the path and this also did not work.
Code:
Browser("name:=Field Activity").Page("title:=Field Activity").Frame("name:=FA_TYPE_CHAR").WebTable("innertext:=Characteristic Type Sequence Characteristic Value Check Type").WebEdit("name:=FA_CHAR:0$CHAR_VAL").Set "FLOODCHK"


I have used the Object spy to identify other properties I can use within the WebEdit portion, but I can not make it work like:"html id:=FA_CHAR:0$CHAR_VAL"

Here is what the Object Spy has returned when click on the cell:
Class name WebEdit
abs_x 547
abs_y 445
class data dc-CHAR-NONE-16-0 forms
default value empty when first trying to populate the cell
disabled 0
height 19
html id FA_CHAR:0CHAR_VAL
html tag INPUT
innerhtml
innertext
kind single line
max length 16
name FA_CHAR:0CHAR_VAL
outerhtml <INPUT class =" > lot of words here....
outertext
readonly 0
rows 0
type text
value
visible True
width 112
width in characters 18
x 331
y 122

Also, can someone please include examples of successful 'DP' code that can obtain a value from a table or debugging commands I can use to find out what's going on? (just learned about the .highlight command yesterday...)

Thanks in advance Mark S.


RE: descriptive programming setting a value in a WebEdit table. - manishbhalshankar - 11-30-2010

Check the properties of webedit using ObjectSpy and use unique properties in DP


RE: descriptive programming setting a value in a WebEdit table. - PrabhatN - 11-30-2010

Hello Mark,

By going through your description, What I think is the name of the WebEdit changes every time you launch the application.

Are "FA_CHAR: and "CHAR_VAL" always part of the WebEdit name?

If so, then try the below code once,

Code:
Browser("name:=Field Activity").Page("title:=Field Activity").Frame("name:=FA_TYPE_CHAR").WebEdit("name:=FA_CHAR.*CHAR_VAL.*").Set "FLOODCHK"

If there are more than 1 objects matching the property, then include the index property.

And yes, you do not need to add the WebTable to the hierarchy

Let me know how it goes.


RE: descriptive programming setting a value in a WebEdit table. - mark spurny - 12-02-2010

Thank you for your reply.

I continued to add and use the entries of WebEdit("name:=FA_CHAR:0$CHAR_VAL","id:=FA_CHAR:0$CHAR_VAL") since this is unique to each webedit box. However it still do not work.
When using the Object Spy, --> index <-- was not an option. I even tried to use your suggestion of using wild cards (*) and still no luck.

I then used .WebEdit("abs_x:=477","abs_y:=459") and that defined my area that I want to use.

I then figured out that there are 18 units between boxes, so I will make a loop and spin thru each field.

Thanks for all of your help.
Mark S.[/b][/i]


RE: descriptive programming setting a value in a WebEdit table. - bfakruddin - 12-02-2010

Hi,

WebEdit is in Table or not? If it is in WebTable, handling situation is different... If it is just on page, handling is different.

make sure about the parent object. Then, proceed.


RE: descriptive programming setting a value in a WebEdit table. - mark spurny - 12-02-2010

Thanks for continuing this string...

Being new to QTP, this is how I would describe the sitiuation (By the way, I am using QTP 8.2 --> Not sure if this makes a difference).

Using Object Spy, I see that 'WebEdit' is within the Browser, Page, Frame, and WebTable.
Also, I do not see "index" as a property within "WebEdit" or "WebTable" although I see the value of "FA_CHAR:0$CHAR_VAL" within the property of "html id" --> By seeing the "0$CHAR_VAL", I assumed this means it is a table.

If someone could post an example of how to pull values from a "WebTable" and place it into a spreadsheet vs. from a "Page" --> that would be awesome. Hopefully, then I can then see what the difference is.

I appreciate any help in this matter.
Mark S


RE: descriptive programming setting a value in a WebEdit table. - bfakruddin - 12-02-2010

Hmm....

I hope you're beginner... good, Object identification is same in 8.2 and upto 10.0... Object spy will show most of the object in WebTable. But, once you add that object object Repository it won't show you that object in WebTable, just it shows that the object under page.

Eg: www.google.com,
Spy on Search field... It will show it is under a table.
Add that Search field to OR, It won't show that table in OR. so, it doesn't required that table to identify that object.

Now, in your scenario... add object to OR first then check WebEdit's ParentObject.
Get me this info... I'll give you the code to identify object.