Success in config test, error on working

// BLOCK: Open Browser
data.ExecutingBlock("Open Browser");
await PuppeteerOpenBrowser(data).ConfigureAwait(false);

// BLOCK: Random User Agent
data.ExecutingBlock("Random User Agent");
string randomUserAgentOutput = RandomUserAgent(data, RuriLib.Providers.UserAgents.UAPlatform.Mobile);

// BLOCK: Navigate To
data.ExecutingBlock("Navigate To");
await PuppeteerNavigateTo(data, $"http://www.url.br/busca?termo={input.cpf}", PuppeteerSharp.WaitUntilNavigation.Load, "http://www.url.br/", 30000).ConfigureAwait(false);

// BLOCK: Get CPF
data.ExecutingBlock("Get CPF");
string resultadocpf = await PuppeteerGetAttributeValue(data, RuriLib.Functions.Puppeteer.FindElementBy.Id, "resultados", 0, "innerText").ConfigureAwait(false);
data.MarkForCapture(nameof(resultadocpf));

// BLOCK: Get link cpf
data.ExecutingBlock("Get link cpf");
string pathfirstclick = await PuppeteerGetAttributeValue(data, RuriLib.Functions.Puppeteer.FindElementBy.XPath, "//*[@id=\"resultados\"]/div/h4/a", 0, "href").ConfigureAwait(false);
data.MarkForCapture(nameof(pathfirstclick));

// BLOCK: Navigate To
data.ExecutingBlock("Navigate To");
await PuppeteerNavigateTo(data, $"{pathfirstclick}", PuppeteerSharp.WaitUntilNavigation.Load, "http://www.url.br/", 30000).ConfigureAwait(false);

// BLOCK: get-link-verificar-obs
data.ExecutingBlock("get-link-verificar-obs");
string verificarobs = await PuppeteerGetAttributeValue(data, RuriLib.Functions.Puppeteer.FindElementBy.XPath, "//*[@id=\"btnDetalharBpc\"]", 0, "href").ConfigureAwait(false);
data.MarkForCapture(nameof(verificarobs));

// BLOCK: Navigate To
data.ExecutingBlock("Navigate To");
await PuppeteerNavigateTo(data, $"{verificarobs}", PuppeteerSharp.WaitUntilNavigation.Load, "http://www.url.br/", 30000).ConfigureAwait(false);

// BLOCK: get-detalhes
data.ExecutingBlock("get-detalhes");
string getdetalhes = await PuppeteerGetAttributeValue(data, RuriLib.Functions.Puppeteer.FindElementBy.XPath, "//*[@id=\"tabelaDetalheDisponibilizado\"]/tbody/tr[1]", 0, "innerText").ConfigureAwait(false);
data.MarkForCapture(nameof(getdetalhes));

results:

Sliced data into:

cpf: data

 

>> Open Browser (PuppeteerOpenBrowser) <<

Headless Browser opened successfully!

 

>> Random User Agent (RandomUserAgent) <<

Getting random UA from the builtin provider

Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/80.0.3987.95 Mobile/15E148 Safari/604.1

 

>> Navigate To (PuppeteerNavigateTo) <<

Navigated to http://www.url.br/busca?termo=data

 

>> Get CPF (PuppeteerGetAttributeValue) <<

Got value data

 of attribute innerText by executing document.querySelectorAll('#resultados')[0].innerText;
Variable resultadocpf marked for capture

 

>> Get link cpf (PuppeteerGetAttributeValue) <<

Got value http://www.url.br/busca/data of attribute href by executing document.evaluate("//*[@id=\"resultados\"]/div/h4/a", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.href;

Variable pathfirstclick marked for capture

 

>> Navigate To (PuppeteerNavigateTo) <<

Navigated to http://www.url.br/busca/data

 

>> get-link-verificar-obs (PuppeteerGetAttributeValue) <<

Got value http://www.url.br/data of attribute href by executing document.evaluate("//*[@id=\"btnDetalharBpc\"]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.href;

Variable verificarobs marked for capture

 

>> Navigate To (PuppeteerNavigateTo) <<

Navigated to http://www.url.br/data

 

>> get-detalhes (PuppeteerGetAttributeValue) <<

Got value 12/2020
	
some data 

	 of attribute innerText by executing document.evaluate("//*[@id=\"tabelaDetalheDisponibilizado\"]/tbody/tr[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerText;
Variable getdetalhes marked for capture

BOT ENDED AFTER 7965 ms WITH STATUS: NONE

If in config tester I’m able to get data with any error but when start a real work what would be the reason for I am getting error/ban?

Otherwise if I comment from line // BLOCK: Get link cpf to the end I stop getting error
I was guessing that maybe navigate don’t was getting response, but, this line // BLOCK: GET LINK still being processed before the navigate.


link to image: https://discourse.openbullet.dev/uploads/default/original/2X/4/4534f67e19fc96dcf7e70d62fcbcb3804fda8f27.png

any help?

If I understand correctly this guide might help you

1 Like