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

How to highlight fields #3476

Closed
incoming-th opened this issue Oct 26, 2022 · 3 comments · Fixed by #3672
Closed

How to highlight fields #3476

incoming-th opened this issue Oct 26, 2022 · 3 comments · Fixed by #3672

Comments

@incoming-th
Copy link

What are you trying to achieve?

Is there a way to highlight the fields of elements (with a border or any CSS of our choice) when codeceptJS is clicking or filling them? This will provide good feedback on what field(s) in the page the script is interacting with.

@incoming-th
Copy link
Author

incoming-th commented Nov 22, 2022

Adding a bit more to this, is there any way to "listen" any changes or click made on the page?

This will help to then retrieve the element (locator?) and apply a css style in it.

Another way should be to copy the Helper (such as Puppeteer) and add this feature on the locator, for example:

  let matcher = await this.context;
  if (context) {
    const els = await this._locate(context);
    assertElementExists(els, context);
    matcher = els[0];
  }
  const els = await findClickable.call(this, matcher, locator);
  if (context) {
    assertElementExists(els, locator, 'Clickable element', `was not found inside element ${new Locator(context).toString()}`);
  } else {
    assertElementExists(els, locator, 'Clickable element');
  }

  // Add something here
  let element = els[0];
  this.evaluate(el => el.style.border = "2px solid blue", element);

  await els[0].click(options);

  const promises = [];
  if (options.waitForNavigation) {
    promises.push(this.waitForNavigation());
  }
  promises.push(this._waitForAction());
  return Promise.all(promises);
}```

@DavertMik
Copy link
Contributor

yeah, I had idea about it but didn't have time...

@kobenguyent
Copy link
Collaborator

May you elaborate your idea then perhaps community could help? @DavertMik

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

Successfully merging a pull request may close this issue.

3 participants