lucgagan / auto-playwright

Automating Playwright steps using ChatGPT.
https://ray.run/blog/auto-playwright
MIT License
410 stars 59 forks source link

TypeError: Cannot read properties of undefined (reading 'defaults') #36

Open prathyusha586-0408 opened 2 months ago

prathyusha586-0408 commented 2 months ago

Hello,

Am facing below error, I have set the OPENAI_API_KEY in .env file and also set in my systems environment variables, but still facing the error. Can anyone pls help me as am exploring this new AI feature to integrate into automation framework.

TypeError: Cannot read properties of undefined (reading 'defaults')

  13 |     const aiArgs = { page, test }
  14 |     await page.waitForTimeout(3000)
> 15 |     await auto(`Type "auto-playwright" in the search box`, aiArgs, options)
     |     ^
  16 |     await auto('Press enter', aiArgs, options)
  17 |     await page.waitForTimeout(5000)

Response is very much appreciated, TIA.

prathyusha586-0408 commented 2 months ago

@lucgagan , could you pls help to resolve the issue.

rajeshdavidbabu commented 2 months ago

Alright just raised a PR https://github.com/lucgagan/auto-playwright/pull/40

prathyusha586-0408 commented 2 months ago

@rajeshdavidbabu , still am facing the defaults issue after updating the import statement at per your latest, so it would be great to help me for the solution.

david-grandfield commented 1 month ago

Reviewing this autoplaywright for a hackathon project and the current version is unusable without a fix for TypeError: Cannot read properties of undefined (reading 'defaults') at sanitizeHtml (c:\repo\POC Stuff\AutoPlaywright\node_modules\auto-playwright\dist\sanitizeHtml.js:23:46) at getSnapshot (c:\repo\POC Stuff\AutoPlaywright\node_modules\auto-playwright\dist\getSnapshot.js:7:46) at runTask (c:\repo\POC Stuff\AutoPlaywright\node_modules\auto-playwright\dist\auto.js:37:19) at node_modules\auto-playwright\dist\auto.js:17:24 at tests\auto-examples.spec.ts:7:3

manikandanma17 commented 1 month ago

I am also facing the same issue though OpenAI API_Key is set in environment variable,

TypeError: Cannot read properties of undefined (reading 'defaults')

   7 |   // `auto` can query data
   8 |   // In this case, the result is plain-text contents of the header
>  9 |   const headerText = await auto(
     |                      ^
  10 |     "get the header text",
  11 |     { page, test },
  12 |   );
Screenshot 2024-08-29 at 10 34 43 AM