Files
crawl4ai/docs/examples/c4a_script/github_search/generated_search_script.js
UncleCode 08a2cdae53 Add C4A-Script support and documentation
- Generate OneShot js code geenrator
- Introduced a new C4A-Script tutorial example for login flow using Blockly.
- Updated index.html to include Blockly theme and event editor modal for script editing.
- Created a test HTML file for testing Blockly integration.
- Added comprehensive C4A-Script API reference documentation covering commands, syntax, and examples.
- Developed core documentation for C4A-Script, detailing its features, commands, and real-world examples.
- Updated mkdocs.yml to include new C4A-Script documentation in navigation.
2025-06-07 23:07:19 +08:00

39 lines
1.4 KiB
JavaScript

(async () => {
const waitForElement = (selector, timeout = 10000) => new Promise((resolve, reject) => {
const el = document.querySelector(selector);
if (el) return resolve(el);
const observer = new MutationObserver(() => {
const el = document.querySelector(selector);
if (el) {
observer.disconnect();
resolve(el);
}
});
observer.observe(document.body, { childList: true, subtree: true });
setTimeout(() => {
observer.disconnect();
reject(new Error(`Timeout waiting for ${selector}`));
}, timeout);
});
try {
const searchInput = await waitForElement('#adv_code_search input[type="text"]');
searchInput.value = 'crawl4AI';
searchInput.dispatchEvent(new Event('input', { bubbles: true }));
const languageSelect = await waitForElement('#search_language');
languageSelect.value = 'Python';
languageSelect.dispatchEvent(new Event('change', { bubbles: true }));
const starsInput = await waitForElement('#search_stars');
starsInput.value = '>10000';
starsInput.dispatchEvent(new Event('input', { bubbles: true }));
const searchButton = await waitForElement('#adv_code_search button[type="submit"]');
searchButton.click();
await waitForElement('.codesearch-results, #search-results');
} catch (e) {
console.error('Search script failed:', e.message);
}
})();