github.com
Helium
A Python library that simplifies browser automation.
https://github.com/mherrmann/heliumAbout This Resource
A Python library that simplifies browser automation. It provides concise commands for interacting with pages, including clicking controls, entering text, and finding elements.
Saved Notes
Original notes saved with this link. They may describe an earlier version.
GitHub - mherrmann/helium: Lighter web automation with Python
Helium is a Python library for automating browsers such as Chrome and Firefox.
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.
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.