retrieving values of fields from a web page - 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: retrieving values of fields from a web page (/Thread-retrieving-values-of-fields-from-a-web-page) |
retrieving values of fields from a web page - kordirko - 10-24-2012 Hi, I am using QTP 11, Internet Explorer 7 and 8. my Application has a web page that displays a table containing fields' names and their values. I want to retrieve values of particular fields from this page. I am facing a problem while retrieving these values because, depending on the user rights, a field can be displayed either as a WebEdit (user can edit the field's content) or a WebElement (field is read only). The same fields can be read only for one user, and editable for the other, and I cannot predict how the field will be displayed. Below is an example how HTML code of this page looks like, this code contains two fields: FieldName1 & FieldName2 with corresponding values: Value 1 and Value 2. FieldName1 is editable, and FieldName2 is read only. Code: <table> http://mtvk.pl/kordirko/xx1.html http://mtvk.pl/kordirko/xx2.html Currently I use the below code to retrieve values from this page: Code: If Browser("Test page").Page("Test page").WebEdit("html tag:=INPUT", "class:=wcmFormText", "name:=FieldName1" ).Exist Then The problem is that I have to check hundreds of fields from many pages, 50% of fields are read only on avarage, and the test for existence of fields takes ages. How can I improve this code, is there any smarter way to manage this case? Please advice. |