VERSION BUILD=1010 RECORDER=CR
Chrome Version 90.0.4430.93 64 bits
Windows 10
Also, I am sorry if I say something wrong and I will try to give full information as possible.
1) I am trying to scraping a table, though could not work with regular TAG POS and now I am using CSS Selectors, though with no success.
2) Attached is the example of the html page I am trying to scrape. Observation: After the successful captcha input.
3) The Captcha killing - this part is working very well. The problem starts selecting tags then extracting at line 27.
Here is the complete macro:
Code: Select all
VERSION BUILD=1010 RECORDER=CR
TAB T=1
TAB CLOSEALLOTHERS
'SET !PLAYBACKDELAY 0.00
URL GOTO=https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/cnpjreva_solicitacao.asp
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:cnpj CONTENT=00.360.305/0001-04
' Insert your Anti-Captcha API key here
SET antiCaptchaApiKey XXXXXX
' Fetch Anti-Captcha API key in TEXTAREA.g-recaptcha-response element
TAG POS=1 TYPE=TEXTAREA ATTR=CLASS:g-recaptcha-response CONTENT={{antiCaptchaApiKey}}
' Or you can place the API key in DIV#anticaptcha-imacros-account-key, it will also work
'URL GOTO=javascript:(function(){var<SP>d=document.getElementById("anticaptcha-imacros-account-key");d||(d=document.createElement("div"),d.innerHTML="{{antiCaptchaApiKey}}",d.style.display="none",d.id="anticaptcha-imacros-account-key",document.body.appendChild(d))})();
'
' Include recaptcha.js file with all the functional
URL GOTO=javascript:(function(){var<SP>s=document.createElement("script");s.src="https://cdn.antcpt.com/imacros_inclusion/recaptcha.js?"+Math.random();document.body.appendChild(s);})();
' Most important part: we wait 120 seconds until an AntiCatcha indicator
' with class "antigate_solver" gets in additional "solved" class
SET !TIMEOUT_STEP 120
TAG POS=1 TYPE=DIV ATTR=CLASS:"*antigate_solver*solved*"
TAG POS=1 TYPE=BUTTON:SUBMIT ATTR=TXT:Consultar
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(2)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL1}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(2)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL2}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(3)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL3}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(4)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL4}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(4)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL5}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(5)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL6}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(6)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL7}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(7)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL8}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(8)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL9}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(8)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL10}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(8)>TBODY>TR>TD:nth-of-type(5)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL11}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(9)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL12}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(9)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL13}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(9)>TBODY>TR>TD:nth-of-type(5)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL14}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(9)>TBODY>TR>TD:nth-of-type(7)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL15}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(10)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL16}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(11)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL17}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(12)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL18}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(12)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL19}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(13)>TBODY>TR>TD" EXTRACT=TXT !EXTRACT {{!COL20}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(14)>TBODY>TR>TD>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL21}}
TAG SELECTOR="HTML>BODY>DIV>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>TABLE>TBODY>TR>TD>TABLE:nth-of-type(14)>TBODY>TR>TD:nth-of-type(3)>FONT:nth-of-type(2)>B" EXTRACT=TXT !EXTRACT {{!COL22}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Extract_{{!NOW:ddmmyy_hhnnss}}.csv
How you guys can help me and I am completely all ears to learn a solution.