PDA

View Full Version : Webelements



magiclevinho
17th February 2014, 22:11
Hello Dear Qt-ers!

I don't understand these webelements. I did across the exampless also.
So could you answer, how can I get the value "20:45", using webelements, from the web site which has the following structure ?! :


<body class="soccer _fs gecko gecko27 os-win32">
<div class="container">
<div class="adsclear"></div>
<div id="header"></div>
<div class="content">
<div id="main">
<div id="rc-top"></div>
<div id="tc">
<div id="mc">
<div id="box-over-content-a" style="display: inline;"></div>
<div id="box-over-content-b" style="display: none;"></div>
<div id="box-inner-content-a" style="display: none;"></div>
<div id="box-over-content-d" style="display: none;"></div>
<div id="lang-box-wrapper" style="display: none;"></div>
<script type="text/javascript"></script>
<div id="fsbody" class="flashscore" title="">
<div id="fs_overlay" style="display: none;"></div>
<div id="fsi"></div>
<div id="fscon" title="">
<div id="preload" class="preload pvisit" style="display: none;"></div>
<ul class="ifmenu live-menu" title=""></ul>
<div id="fs" class="fs-table" style="opacity: 1;">
<div id="iframe-box-inner-content-a" style="display: none;"></div>
<div class="odds-content">
<table class="odds soccer" title="">
<colgroup></colgroup>
<thead></thead>
<tbody title="">
<tr id="g_1_277gVqT4" class="tr-first stage-finished" title="" style="cursor: pointer;">
<td class="cell_ib icons left"></td>
<td class="cell_ad time">
20:45
</td>

Thank you for the answer in advance!

ChrisW67
17th February 2014, 23:07
What is "webelements"?

magiclevinho
18th February 2014, 08:00
Thank you ChrisW67 for answering me!

I am trying to get webelements with this code:

QWebElement document = frame->documentElement();
QWebElementCollection elements = document.findAll("td.\"cell_ad time\"");

ChrisW67
19th February 2014, 20:28
Try


QWebElementCollection elements = document.findAll("td.cell_ad");
// or
QWebElementCollection elements = document.findAll("td.time");
// or
QWebElementCollection elements = document.findAll("td.cell_ad.time");