How to capture the td of a web page using selenium vba?

0

The html code looks like this:

<table>
    <tr>
        <td width="01%" class="tex3b"><img height="14" src="/imagens/tm_bullet.gif" width="6"></td>
        <td width="20%" class="tex3b">Órgão</td>
        <td width="01%" class="tex3b">:</td>

The tag I want to select:

        <td width="78%" class="tex3" colspan=4>22204&nbsp;-&nbsp;DEPARTAMENTO NAC.DE OBRAS CONTRA AS SECAS</td>

continued from table:

    </tr>
    <tr>
        <td width="01%" class="tex3b"><img height="14" src="/imagens/tm_bullet.gif" width="6"></td>
        <td width="20%" class="tex3b">UASG</td>
        <td width="01%" class="tex3b">:</td>
        <td width="78%" class="tex3" colspan=4>193003&nbsp;-&nbsp;DNOCS/CEST-CE</td>
    </tr>
    <tr>
        <td width="01%" class="tex3b"><img height="14" src="/imagens/tm_bullet.gif" width="6"></td>
        <td width="20%" class="tex3b">Licitação</td>
        <td width="01%" class="tex3b">:</td>
        <td width="25%" class="tex3">PREGÃO</td>
        <td width="20%" class="tex3b" align=right>Número</td>
        <td width="01%" class="tex3b">:</td>
        <td width="32%" class="tex3">00002/2015</td>
    </tr>
    <tr>
        <td width="01%" class="tex3b"><img height="14" src="/imagens/tm_bullet.gif" width="6"></td>
        <td width="20%" class="tex3b">Período de Vigência</td>
        <td width="01%" class="tex3b">:</td>
        <td width="25%" class="tex3b">18/12/2015 até 17/12/2016</td>
        <td width="20%" class="tex3b" align=right>Data Assinatura</td>
        <td width="01%" class="tex3b">:</td>
        <td width="32%" class="tex3">16/12/2015</td>
    </tr>
    <tr>
        <td colspan=4><br></td>
    </tr>
  </table>

I'm trying to capture by Xpath but I was not very successful, the variable is empty! Follow the vba code:

Set objCollection = driver.FindElementByXPath("/html/body/table[2]/tbody/tr[2]/td[4]")
uasg = objCollection.getAttribute("Text") 'captura Uasg
    
asked by anonymous 29.12.2016 / 14:58

1 answer

0

I got it, the code looked like this:

   Set objCollection = driver.FindElementByXPath("/html/body/table[2]/tbody/tr[2]/td[4]")
   uasg = objCollection.Text 'captura Uasg
    
02.01.2017 / 15:36