Live data from Hacker News

Helium: Lighter Web Automation with Python

github.com

31–40 of 53 posts

Re: Helium: Lighter Web Automation with Python

#31
post #30

Earlier quoted context omitted.

Doesn't work for logging into HN: from playwright.sync_api import sync_playwright playwright = sync_playwright().start() browser = playwright.chromium.launch() page = browser.new_page() page.goto('https://news.ycombinator.com/login?goto=news') page.get_by_label('username').fill('mherrmann') # playwright._impl._errors.TimeoutError: Locator.fill: Timeout 30000ms exceeded. I suspect Playwright expects there to be a for…

Depending on when you tried that, there is no such label "username" in view-source: https://news.ycombinator.com/login?goto=news username: password: as they only put text username not and the input is named "acct" (without even the common decency to include autocomplete=username) So if your script really did write that string into a what it thinks is 'username' then that's arguably one more thing to debug when its wi…

Yes, there is no such . There is only such . And Playwright isn't smart enough to understand that that is still the label for the element. Helium is smart enough.

So if your script really did write that string into a what it thinks is 'username' then that's arguably one more thing to debug when its wizardry goes awry in some unknown way

I tested my script. It writes into the correct field. The logic is not hard: "Find an element to the right of the given label." If there are multiple, then Helium uses the one that's closest to the last element it interacted with. That's just how a human would do it. It works surprisingly well. In many years of using Helium, I barely recall this causing problems once.

Try it before judging. You will be surprised by how well it works.

Re: Helium: Lighter Web Automation with Python

#33
post #32

Looks nice. Is it possible start_chrome() with specific chrome browser profile name or re-use existing open firefox/chrome browser session and launch a new tab with specific domain?

I don't know. Please check if Selenium supports this and if yes, use Helium's set_driver(...) or options argument to start_chrome(...).

Re: Helium: Lighter Web Automation with Python

#34
post #30

Earlier quoted context omitted.

Depending on when you tried that, there is no such label "username" in view-source: https://news.ycombinator.com/login?goto=news username: password: as they only put text username not and the input is named "acct" (without even the common decency to include autocomplete=username) So if your script really did write that string into a what it thinks is 'username' then that's arguably one more thing to debug when its wi…

Yes, there is no such . There is only such . And Playwright isn't smart enough to understand that that is still the label for the element. Helium is smart enough. So if your script really did write that string into a what it thinks is 'username' then that's arguably one more thing to debug when its wizardry goes awry in some unknown way I tested my script. It writes into the correct field. The logic is not hard: "Fin…

> And Playwright isn't smart enough to understand that that is still the label for the element. Helium is smart enough.

I'm glad you like your project, and I'm sure there are others who will similarly enjoy that kind of magick. However, it's super disingenuous to write an example that asks a standards based API to find a non-existent element and then clutch pearls because it didn't find a non-existent element. page.get_by_label("I dunno, I didn't read, do what I am thinking").fill('lol') similarly would not work but that's not the awesome dunk you think it is

Re: Helium: Lighter Web Automation with Python

#35
post #34

Earlier quoted context omitted.

Yes, there is no such . There is only such . And Playwright isn't smart enough to understand that that is still the label for the element. Helium is smart enough. So if your script really did write that string into a what it thinks is 'username' then that's arguably one more thing to debug when its wizardry goes awry in some unknown way I tested my script. It writes into the correct field. The logic is not hard: "Fin…

> And Playwright isn't smart enough to understand that that is still the label for the element. Helium is smart enough. I'm glad you like your project, and I'm sure there are others who will similarly enjoy that kind of magick. However, it's super disingenuous to write an example that asks a standards based API to find a non-existent element and then clutch pearls because it didn't find a non-existent element. page.g…

It's not disingenuous. The HN example was literally the first one I tried. It's what happens in the real world. The real world doesn't adhere to standards, much of the time.

Re: Helium: Lighter Web Automation with Python

#36

How can a wrapper around selenium be lighter than it? A wrapper around an API is by definition heavier (more code, more functions) than using the lower level api. It’s not using less resources. It’s not faster (it has implicit waiting). It’s not less code; it’s literally a superset of selenium? Feels like a “selenium framework” is more accurate than light weight web automation? Anyway, there’s no fixing automation te…

> but, personally, as it stands all I can really see is “makes easy things easier with sensible defaults”.

“Lighter” may be used as an alternative adjective to the word easy or easier. Your post, which comes off as very rude, misses the point of how the project is marketed.

At least the OP did not call it Python automation for humans …

Re: Helium: Lighter Web Automation with Python

#37
Nice - I can see some cool agentic flows created using this. A thing I want to look into is creating a sandbox instance (Ubuntu?) and letting an agent do its thing. Could be collecting data or answering questions and I can pull up the window to check in from time to time. It'll be like having an assistant.

Re: Helium: Lighter Web Automation with Python

#38
post #34

Earlier quoted context omitted.

> And Playwright isn't smart enough to understand that that is still the label for the element. Helium is smart enough. I'm glad you like your project, and I'm sure there are others who will similarly enjoy that kind of magick. However, it's super disingenuous to write an example that asks a standards based API to find a non-existent element and then clutch pearls because it didn't find a non-existent element. page.g…

It's not disingenuous. The HN example was literally the first one I tried. It's what happens in the real world. The real world doesn't adhere to standards, much of the time.

Just like what you've done with Selenium, such a wrapper could be written for Playwright (I think that's what most developers end up doing anyways, just in a more domain-specific manner)

Re: Helium: Lighter Web Automation with Python

#40

Earlier quoted context omitted.

It's not disingenuous. The HN example was literally the first one I tried. It's what happens in the real world. The real world doesn't adhere to standards, much of the time.

Just like what you've done with Selenium, such a wrapper could be written for Playwright (I think that's what most developers end up doing anyways, just in a more domain-specific manner)

This project was started long before Playwright existed.

I's an OSS tool that had very good reason to be made the way it was at that time, and continues to be useful (in my opinion).

Post reply on HN