Related
Friends I have to do a test to validate the text inside an element that I am not able to map. I've tried everything!! The element is a tooltip
I did the mapping by xpath but it's horrible!!!
I need to validate all the text of the tooltips of each element of the cell in the status column. Is there an easier way to do this and map the element without using xpath
[![element :txt_tooltip, :xpath, '/html/body/div\[2\]/div/div\[2\]/table/tbody/tr\[3\]/td\[1\]/div/div\[2\]/div\[1\]/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr\[2\]/td\[2\]/table/tbody/tr\[2\]/td/table/tbody/tr\[2\]/td/table/tbody/tr/td/div/div\[2\]/div/div/div/table/tbody/tr\[3\]/td\[6\]/img'
get_text_tooltip = txt_tooltip.text
expect(get_text_tooltip).eq ('Somente Leitura')
-Formatted HTML-
<a name="TVXWFMTGINSTATOCE"></a>
<div class="tvCaption">
<div style="display:inline-block;width:100%">
<img src="r/std/static/pixel.gif" class="icon Enabled icon_grid" draggable="false" onclick="sendEvent(0,event,this,true,0,'','1bfd','ControlMenu#','','','','','');"><img src="r/std/static/pixel.gif" class="icon Enabled icon_norows" draggable="false" onclick="sendEvent(0,event,this,searchImage(this),0,'','1bfd','SelectNone#','','','','','');" alt="Selecionar Nenhum" tooltip="Selecionar Nenhum"><img src="r/std/static/pixel.gif" class="icon Enabled icon_allrows" draggable="false" onclick="sendEvent(0,event,this,searchImage(this),0,'','1bfd','SelectAll#','','','','','');" alt="Selecionar todos" tooltip="Selecionar todos"> Lista campos
<div onclick="if(notSelecting()) sendEvent(0,event,this,searchImage(this),0,'','1bfd','TMMenu#','','','','','');" style="white-space: nowrap;" class="tvMsg tvMsgEna"><img src="r/std/icons/menu64.png" class="icon" draggable="false"></div>
<div onclick="if(notSelecting()) sendEvent(0,event,this,searchImage(this),0,'','1bfd','CambioLabel#','','','','','');" class="tvMsg tvMsgEna" style="white-space: nowrap;" tooltip="Editar Label">
<img src="r/std/static/label16.gif" class="icon" draggable="false">
<div class="tvCaptionSep"></div>
</div>
</div>
</div>
<div>
<div style="" class="tvContent">
<div style="display:table;width:100%; background:inherit;">
<div style="display:table-cell;">
<table class="tvGrid" width="100%">
<tbody>
<tr>
<th colspan="1" class="tvHeader">Nome</th>
<th colspan="1" class="tvHeader">Etiqueta</th>
<th colspan="1" class="tvHeader">Tipo Dado</th>
<th colspan="1" class="tvHeader">Valores </th>
<th colspan="1" class="tvHeader" width="1">Preenchimento automático</th>
<th colspan="1" class="tvHeader">Status </th>
<th colspan="1"></th>
</tr>
<tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1bfd','BtnDropDownRow#',0,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1bfd','Select#',0,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowOdd tvRoll" style="cursor:pointer;">
<td class="tvCell" valign="center" align="left">FLAG_INSERIMENTO_LETTURA_E</td>
<td class="tvCell" valign="center" align="left"> Leitura Existente</td>
<td class="tvCell" valign="center" nowrap="" align="left"></td>
<td class="tvCell" valign="center" align="left"></td>
<td class="tvCell" tooltip="" width="1" valign="center" align="left"></td>
<td class="tvCell" valign="center" align="center"><img tooltip="Facultativo" src="r/std/static/ok16.gif"></td>
<td style="line-height:1px;padding:0px;" class="tvCell" width="30" valign="center" align="center">
<div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1bfd','BtnDropDownRow#',0,'','','','');" class="but">
<div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div>
</div>
</td>
</tr>
<tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1bfd','BtnDropDownRow#',1,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','1bfd','Select#',1,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowEven tvRoll tvRowSelected" style="cursor:pointer;">
<td class="tvCell" valign="center" align="left">XWFMSLETMATRICOLA_E</td>
<td class="tvCell" valign="center" align="left"> Nº Hidrômetro</td>
<td class="tvCell" valign="center" nowrap="" align="left"></td>
<td class="tvCell" valign="center" align="left"></td>
<td class="tvCell" tooltip="[AIMPMATRICOLA]" width="1" valign="center" align="left">
<button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1bfd','AUTOFILLBTN#',1,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON">
<div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div>
</button>
</td>
<td class="tvCell" valign="center" align="center"><img tooltip="Somente Leitura" src="r/std/static/lock16.gif"></td>
<td style="line-height:1px;padding:0px;" class="tvCell" width="30" valign="center" align="center">
<div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','1bfd','BtnDropDownRow#',1,'','','','');" class="but">
<div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div>
</div>
</td>
</tr>
You keep asking the same type of question, and don't appear to be learning anything from the answers. You really need to just go study CSS selectors and learn them - try https://flukeout.github.io/ and work on it until you understand all the selector types.
In this case the code you've shown can't be working alone because you're getting text when the value you need is actually in the tooltip attribute of the element. So either your code doesn't work, or you're moving the mouse first and the HTML is changing to something that shows that attribute as the text content of an element.
to use CSS and get the tooltip value of all the elements you could do something like
all('tr.tvRow .tvCell:nth-child(6) img[tooltip]').map { |el| el['tooltip'] }
which would return an array of the tooltip attribute values of the elements. Technically you could probably drop the 'tr.tvRow' from the beginning of that and it would still work but better safe than sorry. You could use that CSS in a SitePrism 'elements' statement, but until you really understand CSS selectors SitePrism is really just adding more confusion to things.
I opened some calls but I'm going to delete them, I'll explain better in this one.
First of all I'm trying hard to learn, I used to clean houses to survive,
So excuse me if I have a certain difficulty or not learning at the ideal speed, if that matters in this ruthless world.
Come on, I need to capture line by line from a table and validate with the information from an excel spreadsheet. I don't know if it's possible to read the column of this worksheet but I thought and use expect to capture the text of the tooltip and validate against the text that is written in the worksheet.
In this case that my friend Thomas sent, I list all the texts in the tooltip, but I need to get text by text and do the following validation:
page.all('tr.tvRow .tvCell:nth-child(6) img[tooltip]').map { |el| el['tooltip'] }
If it is possible to read each row of the serial table something more or less below
because I don't know how to get the line number that I need too
expect(page).to have_css('tr.tvRow .tvCell:nth-child(6) img[tooltip]', exact_text: "Invisível")
expect(page).to have_css('tr.tvRow .tvCell:nth-child(6) img[tooltip]', exact_text: "Facultativo")
expect(page).to have_css('tr.tvRow .tvCell:nth-child(6) img[tooltip]', exact_text: "Obrigatório")
So, if I can get the specific line I can validate the text of the tooltip of this line and make the assertion with the text that is in the worksheet.
[![<td valign="top" colspan="1" rowspan="1">
<div id="AFRAME_790" onmousedown="event.preventMoving=true;" style="display: inline-block; box-sizing: border-box; min-width: 100%;" class="tv">
<a name="TVXWFMTGINSTATOCE"></a>
<div class="tvCaption">
<div style="display:inline-block;width:100%">
<img src="r/std/static/pixel.gif" class="icon Enabled icon_grid" draggable="false" onclick="sendEvent(0,event,this,true,0,'','790','ControlMenu#','','','','','');"><img src="r/std/static/pixel.gif" class="icon Enabled icon_norows" draggable="false" onclick="sendEvent(0,event,this,searchImage(this),0,'','790','SelectNone#','','','','','');" alt="Selecionar Nenhum" tooltip="Selecionar Nenhum"><img src="r/std/static/pixel.gif" class="icon Enabled icon_allrows" draggable="false" onclick="sendEvent(0,event,this,searchImage(this),0,'','790','SelectAll#','','','','','');" alt="Selecionar todos" tooltip="Selecionar todos"> Lista campos
<div onclick="if(notSelecting()) sendEvent(0,event,this,searchImage(this),0,'','790','TMMenu#','','','','','');" style="white-space: nowrap;" class="tvMsg tvMsgEna"><img src="r/std/icons/menu64.png" class="icon" draggable="false"></div>
<div onclick="if(notSelecting()) sendEvent(0,event,this,searchImage(this),0,'','790','CambioLabel#','','','','','');" class="tvMsg tvMsgEna" style="white-space: nowrap;" tooltip="Editar Label">
<img src="r/std/static/label16.gif" class="icon" draggable="false">
<div class="tvCaptionSep"></div>
</div>
</div>
</div>
<div>
<div style="" class="tvContent">
<div style="display:table;width:100%; background:inherit;">
<div style="display:table-cell;">
<table width="100%" class="tvGrid">
<tbody>
<tr>
<th colspan="1" class="tvHeader">Nome</th>
<th colspan="1" class="tvHeader">Etiqueta</th>
<th colspan="1" class="tvHeader">Tipo Dado</th>
<th colspan="1" class="tvHeader">Valores </th>
<th colspan="1" width="1" class="tvHeader">Preenchimento automático</th>
<th colspan="1" class="tvHeader">Status </th>
<th colspan="1"></th>
</tr>
<tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','790','BtnDropDownRow#',0,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','790','Select#',0,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowOdd tvRoll" style="cursor:pointer;">
<td valign="center" align="left" class="tvCell">FLAG_INSERIMENTO_LETTURA_E</td>
<td valign="center" align="left" class="tvCell"> Leitura Existente</td>
<td align="left" class="tvCell" valign="center" nowrap=""></td>
<td valign="center" align="left" class="tvCell"></td>
<td align="left" width="1" class="tvCell" valign="center" tooltip=""></td>
<td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td>
<td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center">
<div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','790','BtnDropDownRow#',0,'','','','');" class="but">
<div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div>
</div>
</td>
</tr>
<tr oncontextmenu="if(!this.cancelEvent) {sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','790','BtnDropDownRow#',1,'','','');return false;} delete this.cancelEvent;" onclick="if(notSelecting()) sendEvent(0,event,this,true,0,'TVXWFMTGINSTATOCE','790','Select#',1,'','','');" onmousedown="if(event.ctrlKey) this.cancelEvent=true;" class="tvRow tvRowEven tvRoll" style="cursor:pointer;">
<td valign="center" align="left" class="tvCell">XWFMSLETMATRICOLA_E</td>
<td valign="center" align="left" class="tvCell"> Nº Hidrômetro</td>
<td align="left" class="tvCell" valign="center" nowrap=""></td>
<td valign="center" align="left" class="tvCell"></td>
<td align="left" width="1" class="tvCell" valign="center" tooltip="\[AIMPMATRICOLA\]">
<button onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','790','AUTOFILLBTN#',1,'','','','');" class="but butAct" tabindex="0" tooltip="Preenchimento automático ativado" type="BUTTON">
<div><img src="r/std/icons/checkboxselected64.png" class="icon" draggable="false" align="absmiddle"></div>
</button>
</td>
<td valign="center" align="center" class="tvCell"><img tooltip="Invisível" src="r/std/static/minus16.gif"></td>
<td align="center" width="30" style="line-height:1px;padding:0px;" class="tvCell" valign="center">
<div onclick="event.cancelBubble=true;sendEvent(0,event,this,searchImage(this),0,'','790','BtnDropDownRow#',1,'','','','');" class="but">
<div><img src="r/std/icons/menu64.png" class="icon" draggable="false" align="absmiddle"></div>
</div>
</td>
</tr>][1]][1]
You can't use expect(page).to have_css('tr.tvRow .tvCell:nth-child(6) img[tooltip]', exact_text: "Invisível"). The text you are looking for isn't text content of an element (which the text and exact_text options would match against) it's an attribute value - https://www.w3schools.com/html/html_attributes.asp. If you go through the learning experience I sent in my previous answer you would learn about CSS attribute selectors - https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors - which would lead you to something like
expect(page).to have_css('tr.tvRow .tvCell:nth-child(6) img[tooltip="Invisível"]')
if you also need to validate it is in a specific row then you could use the CSS nth-child selector like
expect(page).to have_css('tr.tvRow:nth-child(1) .tvCell:nth-child(6) img[tooltip="Invisível"]')
I would really recommend you go through the learning experience I linked you to - https://flukeout.github.io/ - and learn the CSS if that's what you want to be using to select elements.
This is how it looks in GMail mobile app when sent from Outlook:
How can I avoid those big gaps?
My code is as follows:
<table id="sig" width='320' cellspacing='0' cellpadding='0' border-spacing='0' style="width:320px;margin:0;padding:0;">
<tr>
<td valign='top' width="120" height="48" style="width:120px;height:48px;margin:0;padding:0;vertical-align:top;">
<a style="border:none;text-decoration:none;">
<img moz-do-not-send="true" src="https://s3.amazonaws.com/media_crisalix/signatures/logo.jpg" alt="Crisalix" width='120' height='48' style="border:none;width:120px;height:48px;display:block;">
</a>
</td>
</tr>
<tr>
<td>
<table id="sig1" cellspacing='0' width='320' cellpadding='0' border-spacing='0' style="padding:0;margin:0;font-family:sans-serif,Arial,'Helvetica Neue',Helvetica;mso-line-height-rule:exactly;line-height:11px;color:#b0b0b0;border-collapse:collapse;-webkit-text-size-adjust:none;width:320px;">
<tr style="margin:0;padding:0;">
<td style="width:320px;margin:0;padding:0;font-family:sans-serif,Arial,'Helvetica Neue',Helvetica;white-space:nowrap;font-weight:600;line-height:1.6;font-size:13px;">
<span style="color:#137191">Jaime</span>
</td>
</tr>
<tr style="margin:0;padding:0;">
<td style="width:320px;margin:0;padding:0;font-family:sans-serif,Arial,'Helvetica Neue',Helvetica;white-space:nowrap;font-size:12px;line-height:1">
<span style="color:#555555">Chief Executive Officer</span>
</td>
</tr>
<tr>
<td valign='top' width="27" height='21' style="width:27px;height:1px;margin:0;padding:0;vertical-align:top;">
<img moz-do-not-send="true" src="https://s3.amazonaws.com/media_crisalix/signatures/separator.jpg" alt="Crisalix" width='27' height='21' style="border:none;width:27px;height:21px;display:block;">
</td>
</tr>
<tr style="margin:0;padding:0;">
<td style="width:320px;margin:0;padding:0;font-family:sans-serif,Arial,'Helvetica Neue',Helvetica;white-space:nowrap;font-size:12px;line-height:1.4;">
<div><span style="color:#137191;font-weight:bold">P / </span><span style="color:#555555;"></span></div>
<div><span style="color:#137191;font-weight:bold">A / </span><span style="color:#555555">Parc Scientifique (PSE-A) - EPFL1015</span></div>
<div> <span style="color:#555555"> Lausanne | Switzerland </span></div>
</td>
</tr>
<tr style="margin:0;padding:0;">
<td style="margin:0;padding:0;font-family:sans-serif,Arial,'Helvetica Neue',Helvetica;white-space:nowrap;font-weight:600;line-height:1.6;font-size:13px;width:320px;">
<span style="color:#137191;border:none;text-decoration:none!important;color:#137191;">www.crisalix.com</span>
</td>
</tr>
<tr>
<td valign='top' width="27" height='21' style="width:27px;height:1px;margin:0;padding:0;vertical-align:top;">
<img moz-do-not-send="true" src="https://s3.amazonaws.com/media_crisalix/signatures/separator.jpg" alt="Crisalix" width='27' height='21' style="border:none;width:27px;height:21px;display:block;">
</td>
</tr>
</td>
</table>
</tr>
<tr>
<td valign='top' width="230" height="225" style="width:230px;height:225px;margin:0;padding:0;vertical-align:top;">
<a href='http://www.crisalix.com' title="Crisalix" style="border:none;text-decoration:none;">
<img moz-do-not-send="true" src="https://s3.amazonaws.com/media_crisalix/signatures/signature-banner.jpg" alt="Crisalix" width='230' height='225' style="border:none;width:230px;height:225px;display:block;">
</a>
</td>
</tr>
</table>
I wish to parse through a epinions.com page to gather some statistics about a few companies. Epinions have almost no id's or classes, so it's quite difficult to parse the site.
I need to loop through all <tr bgcolor="white"> objects. I have put in 2 samples of this.
From the sample 1, I need to extract:
The alt on this line:
<img src="http://img.epinions.com/images/epi_images/ratings/checks_sm_5.0.gif" alt="Store Rating: 5.0" width="79" height="13" border="0">
The href this line:
CHUMBO ROCKS!
The author at this line:
<span class="rgr">by whitey436, Jan 18, 2006
Here is sample 1:
<tr bgcolor="white">
<td style="padding:10px 5px" align="right" valign="top" height="100%">
<table cellspacing="4" cellpadding="0" border="0" width=100% height="100%">
<tr valign="top">
<td class="rkr" nowrap>Overall Rating:</td>
<td width=80>
<img src="http://img.epinions.com/images/epi_images/ratings/checks_sm_5.0.gif" alt="Store Rating: 5.0" width="79" height="13" border="0">
</td>
</tr>
<span class="rgr">
<tr>
<td class="rgr" nowrap>Ease of Ordering:</td>
<td>
<img src="http://img.epinions.com/images/epi_images/e3/quant_5.gif" width=80 height=11>
</td>
</tr>
<tr>
<td class="rgr" nowrap>Customer Service:</td>
<td>
<img src="http://img.epinions.com/images/epi_images/e3/quant_5.gif" width=80 height=11>
</td>
</tr>
<tr>
<td class="rgr" nowrap>Selection:</td>
<td>
<img src="http://img.epinions.com/images/epi_images/e3/quant_5.gif" width=80 height=11>
</td>
</tr>
<tr>
<td class="rgr" nowrap>On-Time Delivery:</td>
<td>
<img src="http://img.epinions.com/images/epi_images/e3/quant_5.gif" width=80 height=11>
</td>
</tr>
</span>
<tr valign="bottom" height="100%">
<td class="rkb" colspan="2">
<div align="center"> </div>
<div align="center"> </div>
</td>
</tr>
</table>
</td>
<td style="padding:10px;" colspan=2 width="100%" align="left" valign="top">
<h2 style="font-family:arial,helvetica,sans-serif; font-size:87%; color:#000000; font-weight:bold; margin-bottom:0px;">
CHUMBO ROCKS!
</h2>
<span style="line-height:110%">
<span class="rgr">by whitey436, Jan 18, 2006
Rated a <span style="color:#000;">Very Helpful Review</span> by the Epinions community</span>
</span>
<span class="rkr">
<div style="padding:5px 0px"> Its just this simple, I tried buying this receiver from another online supplier who had the lowest price only to find they didnt have any of these units and they wanted to sell me extra warranty then tried to sell a different model in stock from Yamaha ...</div>
<b>
Read the full review
</b>
</span>
</td>
</tr>
From the sample 2, I need to extract:
The alt on this line:
<img src="http://img.epinions.com/images/epi_images/ratings/checks_sm_5.0.gif" alt="Store Rating: 5.0" width="79" height="13" border="0">
The href on this line:
Read more
The author at this line:
<span class="rgr">by whitey436, Jan 18, 2006
Rated a <span style="color:#000;">Very Helpful Review</span> by the Epinions community</span>
Here is sample 2:
<tr bgcolor="white">
<td style="padding:10px 5px" align="right" valign="top">
<table cellspacing="4" cellpadding="0" border="0" width=100%>
<tr>
<td class="rkr" nowrap>Overall Rating:</td>
<td width=80>
<img src="http://img.epinions.com/images/epi_images/ratings/checks_sm_5.0.gif" alt="Store Rating: 5.0" width="79" height="13" border="0">
</td>
</tr>
<tr>
<td class='rgr' > </td>
<td>
<img src='http://img.epinions.com/images/epi_images/spacer.gif' width=80 height=11>
</td>
</tr>
</table>
</td>
<td style="padding:10px;" colspan=2 width="100%" align="left" valign="top">
<span class="rgr">Mar 27, 2006 <br>(Not Yet Rated)</span><br>
<span class="rkr"> Very helpful in giving me the information I needed to make a purchase.<br><b>
Read more
</b></span>
</td>
</tr>
Here is some Nokogiri code to print out the information you want using XPath:
xml.xpath("//tr[#bgcolor='white']").each do |el|
# Get the "Overall rating" tr block from the first td and get (first) img alt
puts el.at_xpath("td[1]//tr[td/text()='Overall Rating:']//img/#alt")
# Get the first link from the second td that contains "content" and get href
puts el.at_xpath("td[2]//a[contains(#href, '/content')][1]/#href")
# Get the (first) link that has an itemprop author value and get the href
puts el.at_xpath("td[2]//a[#itemprop='author']/#href")
end
use Nokogiri will be ok.
to get alt, get back all the image tags and keep the img tag with the specified src
imgs = doc.css('img[src="http://img.epinions.com/images/epi_images/ratings/checks_sm_5.0.gif"]')
to get back the href
links = doc.css('a[href*="/content"]')
to get back the author
links = doc.css('a[href*="/user"]')
I have html like the following:
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td height="20" colspan="2">
</td>
</tr>
<tr>
<td height="20" colspan="2" class="fontDestaque2NegritoHome">
MATRÍCULA: PPAAG
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
</td>
<td align="right" valign="middle" class="tx_bd">
</td>
</tr>
<tr>
<td width="35%" align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Fabricante:</span>
</div>
</td>
<td width="59%" align="right" valign="middle" class="tx_bd">
<div align="left">
CESSNA AIRCRAFT</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Modelo:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
T206H</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Número de Série:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
T20608735</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left" class="tx_bold">
Tipo ICAO :
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
C206</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Tipo de Habilitação para Pilotos:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
MNTE</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Classe da Aeronave:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
POUSO CONVECIONAL 1 MOTOR CONVENCIONAL</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Peso Máximo de Decolagem:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
1633 - Kg</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Número Máximo de Passageiros:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
005</div>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle" class="tx_bd">
<div align="left">
</div>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle" background="../images/bgPontilhado.gif"
class="tx_bd">
<div align="left">
<img src="../images/bgPontilhado.gif" width="4" height="1"></div>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle" class="tx_bd">
<div align="left">
</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Categoria de Registro:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
PRIVADA SERVICO AEREO PRIVADOS</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Número dos Certificados (CM - CA)</span>:
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
19040</div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Situação no RAB:</span><span class="stop_litle">
</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="fontRed">ARRENDAMENTO OPERACIONAL/ALIENACAO FIDUCIARIA</span></div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Data da Compra/Transferência:</span>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
</div>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle" class="tx_bd">
<div align="left">
</div>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle" background="../images/bgPontilhado.gif"
class="tx_bd">
<div align="left">
<img src="../images/bgPontilhado.gif" width="4" height="1"></div>
</td>
</tr>
<tr>
<td colspan="2" align="right" valign="middle" class="tx_bd">
<div align="left">
</div>
</td>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Data de Validade do CA: </span>
</div>
</td>
<td width="3%" align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bd">21/05/16</span></div>
</td>
</tr>
<tr>
<td align="right" valign="middle" class="tx_bd">
<div align="left" class="tx_bold">
<div align="left">
Data de Validade da IAM:
</div>
</div>
</td>
<td align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bd">110513</span></div>
</td>
</tr>
<tr>
<td height="18" align="right" valign="middle" class="tx_bd">
<div align="left">
<span class="tx_bold">Situação de Aeronavegabilidade:</span>
</div>
</td>
<td height="18" align="right" valign="middle" class="tx_bd">
<div align="left">
Normal</div>
</td>
</tr>
<tr>
<td height="18" colspan="2" align="right" valign="middle" class="tx_bd">
<div align="left" class="tx_bold">
Motivo(s):
</div>
</td>
</tr>
<tr>
<td height="18" colspan="2" align="right" valign="middle" class="tx_bd">
<div align="left">
<blockquote>
<p>
<span class="tx_bold"></span>
</p>
</blockquote>
</div>
</td>
</tr>
<tr>
<td height="18" colspan="2" align="left" valign="middle" class="tx_bd">
Consulta realizada em: 16/8/2012 15:52:45<br>
</td>
</tr>
I want to grab the following text:
Cessna Aircraft
T206H
T20608735
C206
MNTE
POUSO CONVECIONAL 1 MOTOR CONVENCIONAL
1633 - Kg
005
PRIVADA SERVICO AEREO PRIVADOS
19040
ARRENDAMENTO OPERACIONAL/ALIENACAO FIDUCIARIA
21/05/16
110513
Normal
Some of the div's just contain the text I need. Other div's contain a span that contains the text I need. How would I construct the xpath for this?
Use:
//tr/td[#align='right' and #valign='middle' and #class='tx_bd']
/div[#align='left 'and not(*)]
/text()