Web Scraping - XPath

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Posts: 2
Joined: Mon Dec 31, 2018 5:43 pm

Web Scraping - XPath

Post by ricardo » Mon Dec 31, 2018 5:59 pm

Hello and greetings.

I have the following script:
IETagEventByAttrib>http://www.buscacep.correios.com.br/sis ... ,,04115000
IETagEventByAttrib>http://www.buscacep.correios.com.br/sis ... scar,click,
IEWait>http://www.buscacep.correios.com.br/sis ... dereco.cfm

I would like to capture the result element named Logradouro/Nome: "<td width="150">Rua Pedro Pomponazzi&nbsp;</td>", which is related to the following XPath: /html/body/div[1]/div[3]/div[2]/div/div/div[2]/div[2]/div[2]/table/tbody/tr[2]/td[1]

In order to achieve my goal, which is the correct way to use IETagEventByAttrib? Can I use a XPath reference here?

Posts: 2
Joined: Mon Dec 31, 2018 5:43 pm

Re: Web Scraping - XPath

Post by ricardo » Wed Jan 02, 2019 3:42 am

Instead of using XPath, I found out another way to extract the desired element:
IEGetTagsByAttrib>{"http://www.buscacep.correios.com.br/sis ... valueArray

The valueArray_1 has the following content:
<th width="150">Logradouro/Nome:</th>
<th width="90">Bairro/Distrito:</th>
<th width="80">Localidade/UF:</th>
<th width="50">CEP:</th>
<td width="150">Rua Pedro Pomponazzi&nbsp;</td>
<td>Jardim Vila Mariana&nbsp;</td>
<td>São Paulo/SP&nbsp;</td>
<td width="55">04115-000</td>

Is there a MS (or VBScript) command to directly parse the 'cells' of my table?

User avatar
Marcus Tettmar
Site Admin
Posts: 7079
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK

Re: Web Scraping - XPath

Post by Marcus Tettmar » Wed Jan 02, 2019 2:31 pm

I would use RegEx for this.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply