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

Asked

Viewed 1,001 times

0

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>

continuation of 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 am 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

1 answer

0


I got it, the code went like this:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.