Use the below code this may help you. Set childobjdes = Description.Create() childobjdes("micclass").value="WebElement"
set allobj = Browser().Page("ABC").ChildObjects(childobjdes) mycount = allobj.count If mycount > 0 Then For i= 0 to allobj.count-1 output= allobj.Item(i).GetROProperty("innertext") Rem Output Contains "Version Number X.XX.XX.XXX" Rem Split with Version Number then you will get an array. Rem Take array(1) and Compare with your X.XX.XX.XXX versionNumber = Split(output,"Version Number") IF lcase(trim(versionNumber (1)) = lcase(trim(X.XX.XX.XXX)) Then Msgbox "Pass" REm Return the captured text Exit For Else If i = allobj.count-1 Then Reporte.ReportEvent micFail,"WebElements not Matching","WebElements not Matching" End If Else Reporte.ReportEvent micFail,"No WebElements Displayed","No WebElements Displayed" End IF On Wed, Aug 24, 2016 at 6:50 PM, <sarahme...@gmail.com> wrote: > Hi, > > Thank you for the response, but this won't help me. I can only extract if > I see the text I'm looking for. It's a webpage with text then a box with > lines around it that has "Version Number 3.11.02.104" . I want to get the > number 3.11.02.104 > > I get all the text from the page but this version number is never > captured. My question is how to capture a WebElement that qtp cannot see > or read? > Thanks > > > > On Tuesday, August 23, 2016 at 10:21:04 PM UTC-4, Cuong Tran wrote: > >> Hi, >> >> You should give the sample text to make clarify >> In another way, you can use the below func to get the text between 2 >> special characters (if it can solve your issue) >> >> >> >> >> >> >> >> >> *Function GetTextBetween2Chars(strText,firstDeli,secondDeli) >> firstDelPos = InStrRev(strText, firstDeli) 'position of start delimiter >> secondDelPos = InStrRev(strText, secondDeli) 'position of end delimiter >> stringBwDels = Mid(strText, firstDelPos + 1, >> secondDelPos - firstDelPos - 1) 'extract the string between two delimiters >> GetTextBetween2Chars = stringBwDels End Function* >> Using: strText = "your version: v1500 is the lastest" >> strVer = *GetTextBetween2Chars(strText,"version: "," is the latest")* >> *---> strver = v1500* >> >> On Wednesday, August 24, 2016 at 1:45:34 AM UTC+7, sarah...@gmail.com >> wrote: >>> >>> >>> >>> Hello, >>> >>> I want to get version number off a WebElement. I get all the text but >>> the text on the Webelement that has the version number.. >>> Any help is appreciated. Here's the code I'm using. >>> >>> Thanks >>> >>> >>> Set childobjdes = Description.Create() >>> childobjdes("micclass").value="WebElement" >>> childobjdes("html tag").value= ".*[A-Za-z0-9].*" >>> childobjdes("outertext").value =".*[A-Za-z0-9].*" >>> >>> >>> set allobj = .Page("ABC").ChildObjects(childobjdes) >>> mycount = allobj.count >>> msgbox mycount >>> >>> For i= 0 to allobj.count-1 >>> output= allobj.Item(i).GetROProperty("outertext") >>> >>> >>> If instr(output, "Version Number") > 1 Then >>> msgbox output >>> End If >>> Next >>> >>> >>> thanks >>> >>> >> -- > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to MercuryQTP@googlegroups.com > To unsubscribe from this group, send email to > mercuryqtp+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "QTP - HP Quick Test Professional - Automated Software Testing" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to mercuryqtp+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to MercuryQTP@googlegroups.com To unsubscribe from this group, send email to mercuryqtp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en --- You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group. To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.