playwright / test_evaluate.mjs
and
w
9609abc
raw
history blame
959 Bytes
let res = await fetch('https://gowah44030-playwright.hf.space/evaluate', {
method: "POST",
body: JSON.stringify({
url: 'https://chat.lmsys.org/assets/index-c347e3dc.js',
code: `
(async function(){
return await new Promise(async (resolve)=>{
try {
//resolve(await fetch('https://chat.lmsys.org').then(res=>res.text()));
} catch (e) { resolve(e);}
//return;
const ws = new WebSocket('wss://chat.lmsys.org/queue/join');
ws.addEventListener('error', (e) => { resolve('error');});
ws.addEventListener('open', function open() { resolve('open');});
ws.addEventListener('close', () => { resolve('A') });
//ws.on('message', function message(_data) { console.log(_data);});
});
})()
`,
})
}).then(res=>res.text());
console.log(res);