Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: switch to happy-dom #219

Open
rafael-vasconcellos opened this issue Mar 10, 2025 · 1 comment
Open

Suggestion: switch to happy-dom #219

rafael-vasconcellos opened this issue Mar 10, 2025 · 1 comment

Comments

@rafael-vasconcellos
Copy link

I tried running the JS files with happy-dom instead of playwright, and it worked. I'm reporting this here in case anyone is interested, since it must be faster.

my test code:

import fs from 'fs';
import { fileURLToPath } from 'url';
import path from 'path';
import { Browser } from 'happy-dom';


const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const signer_script = fs.readFileSync(__dirname + "/signer.js", "utf8");
const x_bogus_script = fs.readFileSync(__dirname + "/xBogus.js", "utf8");
const browser = new Browser()
const page = browser.newPage()
page.evaluate(signer_script)
page.evaluate(x_bogus_script)


export function getSignature(url: string) { 
    return page.evaluate(`generateSig({ url: "${url}" })`)
}

export function getBogus(url: string, user_agent: string) { 
    return page.evaluate(`generateBogus("${url}", "${user_agent}")`)
}
@rafael-vasconcellos rafael-vasconcellos changed the title Sugestion: switch to happy-dom Suggestion: switch to happy-dom Mar 10, 2025
@carcabot
Copy link
Owner

If you tested this version and worked, create a pull request in a separate branch to can push it in the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants