@Conner If there are components, then this could be a race condition. try adding a wait to your pup
@Conner If there are components, then this could be a race condition. try adding a wait to your puppeteer script.
Page.waitForFunction() to return a truthy value https://pptr.dev/api/puppeteer.page.waitforfunction__doPostBack will not be instantaneous.waitUntil set to loadawait page.waitForFunction(() => typeof window.__doPostBack === 'function');networkidle0 actually yeahTimeoutError: waiting for function failed: timeout 30000ms exceededignoreHTTPSErrors: 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 ?Page.waitForFunction()__doPostBack__doPostBack__doPostBackloadawait page.waitForFunction(() => typeof window.__doPostBack === 'function');networkidle0TimeoutError: waiting for function failed: timeout 30000ms exceededTimeoutError: waiting for function failed: timeout 30000ms exceededasync 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.connect<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.goto('https://google.com', { waitUntil: 'load' });