{"id":23872780,"url":"https://github.com/herudi/cdv","last_synced_at":"2025-09-08T22:32:19.698Z","repository":{"id":268075681,"uuid":"903243881","full_name":"herudi/cdv","owner":"herudi","description":"Headless Browser Automation in V","archived":false,"fork":false,"pushed_at":"2025-01-14T06:00:29.000Z","size":308,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T09:26:45.433Z","etag":null,"topics":["browser-automation","chrome","devtools-protocol","firefox","headless-chrome","headless-edge","headless-firefox","msedge","vlang"],"latest_commit_sha":null,"homepage":"","language":"V","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/herudi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-14T04:54:49.000Z","updated_at":"2025-03-23T09:22:05.000Z","dependencies_parsed_at":"2025-01-11T09:24:56.414Z","dependency_job_id":"737045ae-1275-4f49-8162-30b50fb82b71","html_url":"https://github.com/herudi/cdv","commit_stats":null,"previous_names":["herudi/cdv"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/herudi/cdv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fcdv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fcdv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fcdv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fcdv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/herudi","download_url":"https://codeload.github.com/herudi/cdv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/herudi%2Fcdv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231445,"owners_count":25245659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-automation","chrome","devtools-protocol","firefox","headless-chrome","headless-edge","headless-firefox","msedge","vlang"],"created_at":"2025-01-03T16:20:56.215Z","updated_at":"2025-09-08T22:32:19.689Z","avatar_url":"https://github.com/herudi.png","language":"V","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDV\n\nHeadless Browser Automation in V.\n\n\u003e Status: Experimental.\n\n\u003e This project based on CDP spec https://chromedevtools.github.io/devtools-protocol.\n\n## Browser Support\n- Chrome/Chromium\n- Edge\n- Firefox\n- Safari \u003ci\u003esoon...\u003c/i\u003e\n- Opera \u003ci\u003esoon...\u003c/i\u003e\n\n## Install\n```bash\nv install --git https://github.com/herudi/cdv\n```\n\n## Import\n```v\nimport cdv\n```\n\n## Usage\n```v\nmut browser := cdv.open_chrome()!\ndefer { browser.close() }\n\nmut page := browser.new_page()\n\n// example config\npage.set_viewport(width: 800, height: 400, is_mobile: true)\npage.set_user_agent('my-user-agent')\n\n// navigate/goto url\npage.navigate('https://news.ycombinator.com/')\n\n// code here for listen event fired before wait until page load finished.\n\n// example listen on_request\npage.on_request(fn (mut req cdv.Request) !bool {\n\tprintln(req)\n\treturn req.next()\n})\n\n// example listen on_response\npage.on_response(fn (mut res cdv.Response) !bool {\n\tprintln(res)\n\treturn res.next()\n})\n\n// wait until load event fired. default to `Page.loadEventFired`.\npage.wait_until()\n// or use `page.wait_for(2 * time.second)`\n// note: timeout in `page.wait_for`, is debouncing from queue of cdp responses.\n\n// code here for other method.\n\n// example generate and save pdf format A4\npage.pdf(format: 'A4', path: './news.pdf')\n\n// example generate and save image format png\npage.screenshot(format: 'png', path: './news.png')\n\n```\n## Example\n#### This example automate fb login using DOM Element.\n```v\nmut browser := cdv.open_chrome()!\ndefer { browser.close() }\n\npage.navigate('https://facebook.com')\npage.wait_until()\n\nmut form := page.selector('form')\nmut email := form.selector('#email')\nmut pass := form.selector('#pass')\nmut submit := form.selector('button[type=\"submit\"]')\n\nemail.set_value('example@gmail.com')\npass.set_value('my_password')\nsubmit.click()\n\npage.wait_until()\npathname := page.eval('window.location.pathname').str()\nif pathname.starts_with('/login') {\n\tprintln('login failed...')\n} else {\n\tprintln('login success...')\n}\n```\n\n#### This example automate fb login using Keyboard.\n```v\nmut browser := cdv.open_chrome()!\ndefer { browser.close() }\n\npage.navigate('https://facebook.com')\npage.wait_until()\n\nmut form := page.selector('form')\nmut email := form.selector('#email')\nemail.focus()\n\nmut keyboard := page.use_keyboard()\nkeyboard.type('example@gmail.com')\nkeyboard.press('Tab')\nkeyboard.type('my_password')\nkeyboard.press('Enter')\n\npage.wait_until()\npathname := page.eval('window.location.pathname').str()\nif pathname.starts_with('/login') {\n\tprintln('login failed...')\n} else {\n\tprintln('login success...')\n}\n```\n\n## License\n\n[MIT](LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherudi%2Fcdv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fherudi%2Fcdv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fherudi%2Fcdv/lists"}