{"id":15971264,"url":"https://github.com/dolph/autopilot","last_synced_at":"2025-04-04T15:43:23.616Z","repository":{"id":141850540,"uuid":"177813902","full_name":"dolph/autopilot","owner":"dolph","description":"A Python library for automating Chrome","archived":false,"fork":false,"pushed_at":"2021-01-18T04:22:24.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-10T01:38:04.808Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dolph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-03-26T15:12:37.000Z","updated_at":"2021-01-18T04:22:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e714589-ac2f-45d9-9585-0637e811888d","html_url":"https://github.com/dolph/autopilot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dolph%2Fautopilot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dolph%2Fautopilot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dolph%2Fautopilot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dolph%2Fautopilot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dolph","download_url":"https://codeload.github.com/dolph/autopilot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208018,"owners_count":20901568,"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","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":[],"created_at":"2024-10-07T20:20:38.298Z","updated_at":"2025-04-04T15:43:23.601Z","avatar_url":"https://github.com/dolph.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `autopilot`: A Python library for automating Chrome\n\n`autopilot` is a wrapper around Selenium, specifically designed to work with\nGoogle Chrome. It implements some human-like behaviors to provide fault\ntolerance and resilience when exercising production web applications, such as:\n\n* Waiting (impatiently) for elements to load on the screen,\n* Refreshing the page when things don't load as expected,\n* Typing input at a human pace, and\n* Reacting with a human reaction time when elements appear on screen.\n\n## Installation\n\n### Dependencies\n\nReference the [`Dockerfile`](Dockerfile) for an example of how to setup the\nenvironment. In general, this project requires:\n\n* WebDriver for Chromium (e.g. `apt-get install chromium-chromedriver`)\n* Python 2.7 with `pip` (e.g. `apt-get install python-pip`)\n* Selenium (e.g. `apt-get install python-selenium` or `pip install selenium`)\n\n### Using `pip`\n\nDistribution via PyPi is not yet available, but you can install the latest version directly from Github:\n\n```bash\npip install git+https://github.com/dolph/autopilot\n```\n\n## Usage\n\nThe primary way to consume `autopilot` is to write an \"autopilot module\", and\nthen invoke the module via the `autopilot` CLI.\n\nHere's a [minimal autopilot module](minimal_autopilot_module.py):\n\n```python\ndef start(browser):\n    browser.get(\"https://google.com/\")\n```\n\nWhen run on the CLI, `autopilot` will launch a browser and pass the browser\nsession to your module's `start()` function, which will then navigate to\nGoogle, and exit:\n\n```bash\nautopilot minimal_autopilot_module.py\n```\n\n### A real-world example\n\nThis example navigates the UPS website to obtain tracking information given a\nparticular tracking number.\n\n```python\nimport os\n\n\ndef start(browser):\n    # Variables are passed in via the environment. For example:\n    # $ TRACKING_NUMBER=\"1Z...\" autopilot ups_tracking.py\n    tracking_number = os.environ['TRACKING_NUMBER']\n\n    # Load the UPS website\n    browser.get('https://www.ups.com/')\n\n    # Select the English / US option\n    browser.click('//a[@data-code=\"en_us\"]')\n\n    # Type our tracking number into the tracking text input\n    browser.type('//textarea[@id=\"ups-track--qs\"]', tracking_number)\n\n    # Click the Tracking submit button\n    browser.click('//button[@id=\"ups-tracking-submit\"]')\n\n    # Find the package status and scheduled delivery date\n    print(browser.find('//*[@id=\"stApp_txtPackageStatus\"]').text)\n    print(browser.find('//*[@id=\"stApp_scheduledDelivery\"]').text)\n```\n\nNote that `click()`, `type()`, and `find()` all accept\n[XPaths](https://www.guru99.com/xpath-selenium.html) as their basic form of\ninput (which are similar to CSS selectors, but more powerful).\n\nThe output, after 10-12 seconds:\n\n```bash\n$ TRACKING_NUMBER=\"1Z...\" autopilot ups_tracking.py\nIn Transit\n03/27/2019\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdolph%2Fautopilot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdolph%2Fautopilot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdolph%2Fautopilot/lists"}