Zurück zum Ranking

mherrmann/helium

Python

Lighter web automation with Python

seleniumselenium-pythonpythonpython3webdriverchromefirefoxweb-automationweb-scrapinghelium
Sterne-Wachstum
Sterne
8.3k
Forks
513
Wochenwachstum
Issues
52
2k4k6k8k
Nov. 2023Sept. 2024Aug. 2025Juli 2026
ArtefaktePyPIpip install helium
README

Lighter web automation with Python

Helium is a Python library for automating browsers such as Chrome and Firefox. For example:

Helium Demo

Helium is being sponsored by SX.org. They offer SOCKS5 proxies for Python browser automation and public web data workflows. Use promo code helium3gb to try them out for free.

SX.org logo

Installation

To get started with Helium, you need Python 3 and Chrome or Firefox.

I would recommend creating a virtual environment. This lets you install Helium for just your current project, instead of globally on your whole computer.

To create and activate a virtual environment, type the following commands into a command prompt window:

python3 -m venv venv
# On Mac/Linux:
source venv/bin/activate
# On Windows:
call venv\scripts\activate.bat

Then, you can install Helium with pip:

python -m pip install helium

Now enter python into the command prompt and (for instance) the commands in the animation at the top of this page (from helium import *, ...).

Your first script

I've compiled a cheatsheet that quickly teaches you all you need to know to be productive with Helium. For a more complete reference of Helium's features, please see the documentation.

Connection to Selenium

Under the hood, Helium forwards each call to Selenium. The difference is that Helium's API is much more high-level. In Selenium, you need to use HTML IDs, XPaths and CSS selectors to identify web page elements. Helium on the other hand lets you refer to elements by user-visible labels. As a result, Helium scripts are typically 30-50% shorter than similar Selenium scripts. What's more, they are easier to read and more stable with respect to changes in the underlying web page.

Because Helium is simply a wrapper around Selenium, you can freely mix the two libraries. For example:

# A Helium function:
driver = start_chrome()
# A Selenium API:
driver.execute_script("alert('Hi!');")

So in other words, you don't lose anything by using Helium over pure Selenium.

In addition to its more high-level API, Helium simplifies further tasks that are traditionally painful in Selenium:

  • iFrames: Unlike Selenium, Helium lets you interact with elements inside nested iFrames, without having to first "switch to" the iFrame.
  • Window management. Helium notices when popups open or close and focuses / defocuses them like a user would. You can also easily switch to a window by (parts of) its title. No more having to iterate over Selenium window handles.
  • Implicit waits. By default, if you try click on an element with Selenium and that element is not yet present on the page, your script fails. Helium by default waits up to 10 seconds for the element to appear.
  • Explicit waits. Helium gives you a much nicer API for waiting for a condition on the web page to become true. For example: To wait for an element to appear in Selenium, you would write:
    element = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.ID, "myDynamicElement"))
    )
    
    With Helium, you can write:
    wait_until(Button('Download').exists)
    

Status of this project

I have too little spare time to maintain this project for free. If you'd like my help, please go to my web site to ask about my consulting rates. Otherwise, unless it is very easy for me, I will usually not respond to emails or issues on the issue tracker. I will however accept and merge PRs. So if you add some functionality to Helium that may be useful for others, do share it with us by creating a Pull Request. For instructions, please see Contributing below.

How you can help

I find Helium extremely useful in my own projects and feel it should be more widely known. Here's how you can help with this:

  • Star this project on GitHub.
  • Tell your friends and colleagues about it.
  • Share it on Twitter with one click
  • Share it on other social media
  • Write a blog post about Helium.

With this, I think we can eventually make Helium the de-facto standard for web automation in Python.

Contributing

Pull Requests are very welcome. Please follow the same coding conventions as the rest of the code, in particular the use of tabs over spaces. Also, read through my PR guidelines. Doing this will save you (and me) unnecessary effort.

Before you submit a PR, ensure that the tests still work:

pip install -Ur requirements/test.txt
python setup.py test

This runs the tests against Chrome. To run them against Firefox, set the environment variable TEST_BROWSER to firefox. Eg. on Mac/Linux:

TEST_BROWSER=firefox python setup.py test

On Windows:

set TEST_BROWSER=firefox
python setup.py test

If you do add new functionality, you should also add tests for it. Please see the tests/ directory for what this might look like.

History

I (Michael Herrmann) originally developed Helium in 2013 for a Polish IT startup called BugFree software. (It could be that you have seen Helium before at https://heliumhq.com.) We shut down the company at the end of 2019 and I felt it would be a shame if Helium simply disappeared from the face of the earth. So I invested some time to modernize it and bring it into a state suitable for open source.

Helium used to be available for both Java and Python. But because I now only use it from Python, I didn't have time to bring the Java implementation up to speed as well. Similarly for Internet Explorer: Helium used to support it, but since I have no need for it, I removed the (probably broken) old implementation.

The name Helium was chosen because it is also a chemical element like Selenium, but it is lighter.

Ähnliche Repositories
SeleniumHQ/selenium

A browser automation framework and ecosystem.

JavaMavenApache License 2.0seleniumwebdriver
selenium.dev
34.3k8.7k
feder-cr/Jobs_Applier_AI_Agent_AIHawk

AIHawk aims to easy job hunt process by automating the job application process. Utilizing artificial intelligence, it enables users to apply for multiple jobs in a tailored way.

PythonPyPIGNU Affero General Public License v3.0automationbot
30k4.6k
CloakHQ/CloakBrowser

Stealth Chromium that passes every bot detection test. Drop-in Playwright replacement with source-level fingerprint patches. 30/30 tests passed.

PythonPyPIMIT Licenseanti-detectbot-detection
cloakbrowser.dev
28.9k2.3k
feder-cr/Jobs_Applier_AI_Agent

Auto_Jobs_Applier_AI_Agent aims to easy job hunt process by automating the job application process. Utilizing artificial intelligence, it enables users to apply for multiple jobs in an automated and personalized way.

PythonPyPIautomationbot
24.5k3.6k
browserbase/stagehand

The SDK For Browser Agents

TypeScriptnpmMIT Licenseagentsai
stagehand.dev
23.6k1.6k
Skyvern-AI/skyvern

Automate browser based workflows with AI

PythonPyPIGNU Affero General Public License v3.0apiautomation
skyvern.com
22.5k2.1k
gildas-lormeau/SingleFile

Web Extension for saving a faithful copy of a complete web page in a single HTML file

JavaScriptnpmGNU Affero General Public License v3.0browserarchive
getsinglefile.com
21.9k1.4k
InstaPy/InstaPy

📷 Instagram Bot - Tool for automated Instagram interactions

PythonPyPIGNU General Public License v3.0instagramclarifai
18k3.9k
Kr1s77/awesome-python-login-model

😮python模拟登陆一些大型网站,还有一些简单的爬虫,希望对你们有所帮助❤️,如果喜欢记得给个star哦🌟

PythonPyPIOtherpythonspiders
16.2k3.2k
budtmo/docker-android

Android in docker solution with noVNC supported and video recording

PythonPyPIOtherdocker-androidandroid
15.6k1.7k
shengqiangzhang/examples-of-web-crawlers

一些非常有趣的python爬虫例子,对新手比较友好,主要爬取淘宝、天猫、微信、微信读书、豆瓣、QQ等网站。(Some interesting examples of python crawlers that are friendly to beginners. )

HTMLMIT Licensecrawlerspider
14.7k3.8k
schickling/chromeless

🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda.

TypeScriptnpmMIT Licenseserverlessintegration-testing
chromeless.netlify.com
13.2k569