Skip to content

Can I interact with a playwright page and then run Audit.of() again? #963

Answered by Jym77
lovebes asked this question in Questions
Discussion options

You must be logged in to vote

Hi @lovebes, sorry for the late answer.
If I understand your use case properly, this MWE should illustrate how to do it. The main trick is that the playwright page (and handle) stays the same even if the page changes through actions, so we can regularly call Playwright.toPage and get the current state.

Here's my awesome SPA:

<style>
  #result { color: #CCC} /* Creating a color contrast issue */
</style>

<script>
  function submit() {
    const name = document.getElementById("input").value;

    document.getElementById("result").innerText = `Your name is ${name}`;
  }
</script>

<label>Your name:<input id="input" type="text" /></label>
<button id="submit" onclick="submit()">Submit</button>
<

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@lovebes
Comment options

@jrpool
Comment options

@Jym77
Comment options

Answer selected by Jym77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants