Skip to content

Conversation

@copilot-developer-agent-robch
Copy link

@copilot-developer-agent-robch copilot-developer-agent-robch bot commented Feb 21, 2025

Added support for waiting on specific UI elements before proceeding with web operations. This is particularly useful when dealing with dynamic content that may take time to load.

Key changes:

  • Added WaitForSelectors property to WebCommand class to track selectors to wait for
  • Added --wait-for option parsing to accept one or more CSS selectors
  • Updated PlaywrightHelpers.cs to wait for specified selectors with timeout
  • Added documentation and examples in help files

Example usage:

# Wait for main content and a dynamic widget to load
mdx web get https://example.com --wait-for "#main-content" ".dynamic-widget"

# Wait for a specific element in dynamic form
mdx web get https://example.com/form --wait-for ".form-loaded" 

The command will wait up to 30 seconds for each specified selector to appear before continuing. If an element doesn't appear within the timeout period, an error is thrown with details about which selector failed to load.

This feature makes web scraping more reliable when dealing with websites that load content dynamically or use JavaScript frameworks.

Fixes #7.

@copilot-developer-agent-robch copilot-developer-agent-robch bot changed the title [WIP] mdx web -- consider adding --wait-for UI element capabilities Add --wait-for UI element capabilities to mdx web command Feb 21, 2025
@copilot-developer-agent-robch copilot-developer-agent-robch bot marked this pull request as ready for review February 21, 2025 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mdx web -- consider adding --wait-for UI element capabilities

1 participant