Any chance cloudflare's browser might not load the aspx?
Any chance cloudflare's browser might not load the aspx?
ignoreHTTPSErrors: true. Instead of default puppeteer.launchignoreHTTPSErrors enabled.custom_launch a trypuppeteer.connect pass it the ignoreHTTPSErrors: trueTimeoutError: waiting for function failed: timeout 30000ms exceeded__doPostBack is defined inline in the javascript of the page, not loaded externallyjavascript:__doPostBack(...), which is still undefined<script> tag contents, but the javascript interpreter is still running, hence why .evaluate() would work.//<![CDATA[ makes some kind of difference here? I don't think it does.__doPostBack ?await page.waitForFunction(() => typeof window.__doPostBack === 'function', { timeout: 30000, polling: 100 });__doPostBack.toString() I getawait page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'); and I've screenshotted both and they're the same __doCallBack ? Or clicking the submit button?theForm isn't defined in there, it's defined just outside by__doPostBack and fill in the eventTarget and any eventArgs. These then get filled in as those hidden __EVENTTARGET and __EVENTARGUMENT input fields defined above. Those get submitted to the server and that's how it knows what button you pressed so it can run the appropriate event handler code on the server, then send you back a new page render.async custom_launch(endpoint: BrowserWorker): Promise<Browser> {
const res = await endpoint.fetch('/v1/acquire');
const status = res.status;
const text = await res.text();
if (status !== 200) {
throw new Error(
`Unabled to create new browser: code: ${status}: message: ${text}`
);
}
// Got a 200, so response text is actually an AcquireResponse
const response: { sessionId: string } = JSON.parse(text);
const transport = await WorkersWebSocketTransport.create(
endpoint,
response.sessionId
);
return puppeteer.connect({ transport, sessionId: response.sessionId, ignoreHTTPSErrors: true, defaultViewport: { width: 1920, height: 1080 } });
}ignoreHTTPSErrors: trueignoreHTTPSErrors: truepuppeteer.launchignoreHTTPSErrorscustom_launchpuppeteer.connectTimeoutError: waiting for function failed: timeout 30000ms exceeded__doPostBack__doPostBack__doPostBack<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>javascript:__doPostBack(...).evaluate()<body>
<form method="post" action="./action.aspx" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'criteria_basic_btn_search')" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""/>
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""/>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="...e"/>
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
...//<![CDATA[await page.waitForFunction(() => typeof window.__doPostBack === 'function', { timeout: 30000, polling: 100 });__doPostBack.toString()function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36');__doCallBacktheFormvar theForm = document.forms['form1'];__EVENTTARGET__EVENTARGUMENT