lucgagan / auto-playwright

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

How to handle SPA website #23

Closed marcaureln closed 8 months ago

marcaureln commented 8 months ago

Hey, I come across auto-playwright via the ray.run blog post, and I really wanted to test it on the project I'm working on.

Still, I don't think it's working, this is the debug output:

message {
  role: 'user',
  content: 'This is your task: go to sign up page\n' +
    '\n' +
    '* When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements).\n' +
    "* Avoid using generic tags like 'h1' alone. Instead, combine them with other attributes or structural relationships to form a unique selector.\n" +
    '* You must not derive data from the page if you are able to do so by using one of the provided functions, e.g. locator_evaluate.\n' +
    '\n' +
    'Webpage snapshot:\n' +
    '\n' +
    '```\n' +
    '\n' +
    '    Cloaked\n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '    \n' +
    '  \n' +
    '  \n' +
    '    \n' +
    "      <strong>We're sorry but cloaked-dashboard doesn't work\n" +
    '        properly without JavaScript enabled. Please enable it to\n' +
    '        continue.</strong>\n' +
    '    \n' +
    '    <main data-v-6aa2cce8><div data-v-170fc09e data-v-100ecb37 data-v-6aa2cce8 class="mount-event" default="default"></div></main>\n' +
    '    \n' +
    '  \n' +
    '\n' +
    '<div></div><div></div><div style="visibility:visible"><div></div><div></div></div>\n' +
    '```\n'
}

I even added timeout between the page.goto and auto() to give time to JS, but it seems that JS is disabled at all. What can I do for it?

rakaadinugroho commented 8 months ago

i thinks its still not possible for now because the core of the concept sanitize the html code from the page. you can try using zeroStep to more complex needed (dom manipulation)

marcaureln commented 8 months ago

Thanks @rakaadinugroho. The Chrome DevTools Protocol has a DOM snapshot feature, I'm going to use that.