Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to identify a Dynamic WebElement?
#1
I want to identify a web element (TIN Number) which is dynamic in nature. Every time the value is different. I used below code.  The innertext is not updating . How to identify innertext dynamically? I have attached object spy as well. Currently TIN value is "113482671" but will change in the next iteration. Please help!!


Code:
Public Function SelectTIN() Dim obj Set a=Description.Create a("html tag").value = "A" a("micclass").value="Link" a("innerhtml").value= Datatable.value("TINNumber") set obj = Browser("Micclass:=Browser").Page("Micclass:=Page").ChildObjects(a) x= obj.count For i=0 to x-1 obj(i).click Next SelectTIN = True End Function

Code:
'..........Store TIN Number Public Function StoreTINNumber() TINNumber = Browser("1099 Detail DB").Page("1099 Detail DB").WebElement("ctl00$ContentPlaceHolder1$gvEd").GetROProperty("innertext") DataTable.Value("TINNumber","Search Shared TIN")= TINNumber StoreTINNumber = True End Function


Code:
'............Get TIN Number Public Function GetTINNumber() Dim obj Datatable.GetSheet("Search Shared TIN") Set a=Description.Create a("html tag").value = "A" a("micclass").value="Link" a("innerhtml").value= Datatable.value("TINNumber","Search Shared TIN") 'It will give value 00001545 set obj = Browser("Micclass:=Browser").Page("Micclass:=Page").ChildObjects(a) x= obj.count For i=0 to x-1 obj(i).click Next GetTINNumber = True End Function


Attached Files Image(s)
   
Reply
#2
Using ChildObjects fetch the dynamic value of innertext and use that in a Descriptive programming statement.

You seem to be mixing two methods of writing Descriptive programming statements.

Here is the simplest way in your case to identify the webelement, (once you have fetched the value above).


Code:
Browser("micclass:=Browser").Page("micclass:=Page").WebElement("micclass:=Web Element","innertext:="&TIN).Click
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  not able to identify an webelement object Ninjukp 0 2,664 01-10-2018, 09:25 PM
Last Post: Ninjukp
  How to identify dynamic webtable as unique in QTP? sudheendramurthy 4 19,610 02-23-2016, 06:16 PM
Last Post: vinod123
  Dynamic Webelement Value Novemberrain81 2 7,359 09-30-2013, 11:09 PM
Last Post: Parke
  Identifying radio buttons with same html ID but dynamic webelement properties manishac 12 15,790 05-03-2012, 06:27 AM
Last Post: manishac
  unable to extract dynamic object values-webelement object naniblr9 1 3,784 11-10-2009, 12:20 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)