Apify

Apify and Crawlee Official Forum

b
F
A
J
A

unique id of element to sikp check

πŸ‘‹ Hello Playwright Community,

I'm currently working on a Playwright script where I need to handle various data combinations (such as name, username, surname, email, etc.) on a webpage. My challenge is that some of these data elements may be hidden behind interactive elements (like tabs or dialogs).

To tackle this, I devised a strategy that starts by interacting with all visible <button/> elements on the page. Here's an overview of my approach:

  1. Visit the Target Page: Navigate to the page where data needs to be extracted.
  2. Retrieve Visible Buttons: Gather all visible <button/> elements into an array.
  3. Initial Data Scan: Perform a scan for the required data sets.
  4. Interact with Buttons: Sequentially click each button and remove it from the array after clicking.
  5. Rescan for Data: Post-interaction, perform another scan as some buttons might reveal additional content (like dialogs or tabs).
  6. Refresh Button Array: Re-gather all visible <button/> elements. However, I'm encountering an issue here as this process also re-adds buttons that were previously clicked.
I'm seeking insights or suggestions to optimize this process, especially regarding the efficient handling of the button array to avoid redundancies. Any advice or alternative strategies would be greatly appreciated!

Thank you in advance! πŸ™
Add a reply
Sign up and join the conversation on Discord
Join