Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DIV and span tags
#1
Not Solved
Hi,

Good morning.
I am new to QTP. I got the following html code snippet. How can i extract the span tag values under div and ul tags in the following formats.



HTML code:
Code:
<div id=firstheader> HEADER1value </div>
<div id = "firstheadervalues">
<ul>
<li><span class="percentage"> 7% </span> <span class="listval">column1</span></li>
<li><span class="percentage"> 8% </span> <span class="listval">column2</span></li>
<li><span class="percentage"> 9% </span> <span class="listval">column3</span></li>
<li><span class="percentage"> 10% </span> <span class="listval">column3</span></li>
</ul>
</div>


<div id=secondheader> HEADERSECOND </div>
<div id = "secondheadervalues">
<ul>
<li><span class="numval"> 123 </span> <span class="secondval">value123</span></li>
<li><span class="numval"> 124 </span> <span class="secondval">value124</span></li>
<li><span class="numval"> 125 </span> <span class="secondval">value125</span></li>
<li><span class="numval"> 126 </span> <span class="secondval">value126</span></li>
</ul>
</div>

How can i print the values in the following format????

HEADER1Value
column1 --- 7
column2 --- 8
column3 --- 9
column4 --- 10


HEADERSECOND

value123 -- 123
value124 -- 124
value125 -- 125
value126 -- 126

its urgent.Your help will be greatly appreciated.

Thanks you .
vas.
Reply
#2
Not Solved
Guys, can you please help some one. Thanks. More info the web page build with jquery framework.
Reply
#3
Not Solved
If you're using QTP 11 or UFT 11.5, your job has become a tad easier. Use CSS object identification method.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#4
Not Solved
Ankur, Can you please provide me code.

Also we are using QTP 10.

Thank you,
Reply
#5
Not Solved
I hope you were able to solve this, in case not here is a snippet to get percentage -

Code:
Set oPercentage = Description.Create
oPercentage("micclass").value = "WebElement"
oPercentage("class").value = "percentage"

Set oAllPercentageObjects =  Browser("Browser").Page("Page").ChildObjects(oPercentage)

'msgbox oAllPercentageObjects.Count

For r = 0 To oAllPercentageObjects.count - 1
msgbox oAllPercentageObjects(r).GetROProperty("innerhtml")    
Next
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#6
Not Solved
----------------------------
Dear Ankur,
You solution worked. Thank you!
I am able to go to all the span in the div and pick up values in my case how do I go further and then pick values.

Can you help me with some guidance on how to pick up the anchor values inside and anchor in a div. and a span.
code from where to capture is as below.
I wish to capture
Code:
sip="ABenjwal@uk.com"
showofflinepawn="1"

<td class="ms-vb-lastCell ms-cellstyle ms-vb-user ms-vb-lastCell"><span class="ms-verticalAlignTop ms-noWrap ms-displayInlineBlock"><span class="ms-imnSpan"><a class="ms-imnlink ms-spimn-presenceLink" onclick="IMNImageOnClick(event);return false;" href="#"><span class="ms-spimn-presenceWrapper ms-imnImg ms-spimn-imgSize-10x10"><img name="imnmark" title="" class="ms-spimn-img ms-spimn-presence-online-10x10x32" id="imn_17,type=smtp" alt="Offline" src="https://de17.eyqa.net/_layouts/15/images/spimn.png" sip="ABenjwal@uk.com" showofflinepawn="1"></span></a></span><span class="ms-noWrap ms-imnSpan"><img name="imnmark" title="" class=" ms-hide" id="imn_18,type=smtp" alt="Offline" src="https://de17.qa.net/_layouts/15/images/spimn.png" sip="ABenjwal@uk.com" showofflinepawn="1"><a tabindex="-1" class="ms-imnlink" onclick="IMNImageOnClick(event);return false;" href="#"></a><a class="ms-subtleLink" onclick="GoToLinkOrDialogNewWindow(this);return false;" href="/sites/Taxeng1/_layouts/15/userdisp.aspx?ID=24">George M. Cohan</a></span></span></td>
Reply
#7
Not Solved
you can use combination of GetRoProperty and split to achieve this.
Please let me know if you need a snippet.
Thanks,
SUpputuri
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Identifying a WebGrid using Div Tag - Solved EnthusiasticLearner 2 3,348 01-06-2014, 09:27 PM
Last Post: EnthusiasticLearner
  How to identify HTML tables developed with DIV and SPAN tags as 'WEBTABLE'? bell.ramesh 1 4,003 08-20-2012, 11:07 AM
Last Post: Victor~

Forum Jump:


Users browsing this thread: 1 Guest(s)