GitRead 中文社区
首页趋势排行榜原创文章严选周刊
更多资源
新手训练营
精选专题热门话题GitHub 文档资源精选实战指南

helium

Lighter web automation with Python

  • 语言Python
  • 默认分支master
  • 大小40.7 MB
  • 更新2 周前
  • Issues52
在 GitHub 打开
avatarmherrmann

项目介绍

mherrmann/helium 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 8.3k 个 Star、507 次 Fork。

仓库全名
mherrmann/helium

README 摘要

Lighter web automation with Python Helium is a Python library for automating browsers such as Chrome and Firefox. For example: 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

helium 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 8.3k 个 Star。

helium 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 helium 的源码?

可以直接克隆仓库:git clone https://github.com/mherrmann/helium.git,默认分支为 master;安装与运行步骤见仓库 README。

helium 最近还在维护吗?

仓库最近一次更新为 2 周前,当前有 52 个未关闭 Issue;Star 数为 8.3k,可作为社区活跃度的参考。

本页面展示项目元数据与原始 README,GitRead 中文社区 编辑团队负责选题收录。

相关仓库

public-apis/public-apis avatar
public-apispublic-apis
2 天前
497.7k
55.6k
2.6k

免费 API 汇总列表

apipublic-apisfree+7
Python
15.5 MB
7
详情
EbookFoundation/free-programming-books avatar
free-programming-booksEbookFoundation
2 天前
401.4k
64.4k
39

免费可获取的编程书籍

bookseducationhacktoberfest+2
Python
21.8 MB
3
详情
donnemartin/system-design-primer avatar
system-design-primerdonnemartin
9月15日
377.5k
57.4k
291

学习如何设计大规模系统。为系统设计面试做准备。包含 Anki 闪卡。

designdesign-patternsdesign-system+10
Python
11.0 MB
0
详情
vinta/awesome-python avatar
awesome-pythonvinta
1 天前
333.6k
28.0k
0

回答“我想用 Python 做 X,该用哪个工具?”的权威清单

awesomeawesome-listpython+3
Python
6.9 MB
2
详情
practical-tutorials/project-based-learning avatar
project-based-learningpractical-tutorials
21 小时前
289.4k
36.8k
238

精选的项目实战教程列表

tutorialprojectbeginner-project+5
Python
472 KB
1
详情
NousResearch/hermes-agent avatar
hermes-agentNousResearch
19 分钟前
262.1k
58.4k
54.0k

与你共同成长的智能体

aiai-agentai-agents+10
Python
1.4 GB
3
详情
TheAlgorithms/Python avatar
PythonTheAlgorithms
1 周前
226.0k
51.3k
90

所有算法均用 Python 实现

algorithmalgorithm-competitionsalgorithms-implemented+11
Python
17.9 MB
2
详情
yt-dlp/yt-dlp avatar
yt-dlpyt-dlp
5 天前
206.5k
18.2k
2.8k

功能丰富的命令行音视频下载器

youtube-dlpythonsponsorblock+4
Python
63.5 MB
0
详情

关于

chromefirefoxheliumpythonpython3seleniumselenium-pythonweb-automationweb-scrapingwebdriver
  • MIT License
  • 8.3k Stars
  • 507 Forks
  • 83 Watching

简要分析

热度分
9417
价值分
5149
活跃状态
活跃
GitHub

语言占比

CSS
HTML
JavaScript
Python

Release

  • Make wait_until return(...) return the condition's value2 周前
  • Make select(...) support prefix matches as well7月7日
  • Add support for hidden file input elements6月3日
  • Improve LookupError5月10日
  • Fix relative searches2月5日

贡献者

mherrmannmherrmannIgnisDaIgnisDatbp105tbp105a-l-e-ca-l-e-cvreabernardovreabernardodiemoldiemolJo-BladeJo-Bladesnstantonsnstantonwithshubhwithshubhftnextftnextmasafumi-kiyokawamasafumi-kiyokawajerzybrzoskajerzybrzoska

Lighter web automation with Python

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

Helium Demo

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.

评论

登录 后发表评论
暂无评论
GitRead 中文社区
深度解读 · 趋势洞察 · 价值精选

关于

关于我们联系我们编辑准则收录标准赞赏人员

发现

技术趋势新手训练营资源精选实战指南精选专题热门话题GitHub 文档

条款

隐私政策服务条款网站地图
26.9万收录项目
5.5万中文话题
155精选专题
发现技术价值,连接开源智慧
© 2026 GitRead · GitHub 中文社区 本站与 GitHub, Inc. 无隶属关系;GitHub 是 GitHub, Inc. 的商标。