top | item 31705099

Ask HN: Would you be interested in POM generator for Selenium?

20 points| mesadb | 3 years ago

I have some plans to implement a POM and script generator for Selenium which includes multiples selectors and uses some AI selectors.

It will work this way: - Go to the page you want the POM for - Open the chrome extension - Click on generate POM - We will generate POM - You can add/remove some sections

Some other benefits might come with it is Email and PDF testing for Selenium.

Curious what you think about this?

34 comments

order

jmll|3 years ago

In my (admittedly limited) experience, the difficulty of working with Selenium doesn't stem so much from finding appropriate selectors but from britleness: network delays/timeouts, objects not yet being yet lodaded into the DOM, dynamically generated classnames (think scraping obfuscation).

I do see a niche for an system (AI or not) that deals with that last case (i.e. it automatically grabs some correlated selectors to fallback to), or as a quick tool to scrape static sites.

However (and this may be out of your proposed scope, and that's fine) I see more value on something that can construct a sort of DOM timeline - in order to accurately know what is available and when. If you start "recording" network and user events since page load, you may be able to reconstruct a) which nodes the user interacted with b) which preconditions there are for these nodes to be consistently available, no matter which stochastic delays/errors are present.

This is tricky and time consuming even when done manually, so I'm not sure it can be AI-mplemented. But that's maybe an idea to explore down the line :)

lloydatkinson|3 years ago

For selenium? No absolutely not in fact I would happily pay someone to not add to the horror that is selenium. I would however be interested in a POM generator for Cypress or Web Driver.

ozim|3 years ago

So is really Cypress/Puppeteer/Playwright much more stable than Selenium.

I still think any E2E test tooling will have the same issues and be simply horrible.

glmeece|3 years ago

As an SDET, I'm always looking for quicker/easier ways to get selectors that are non-brittle. The trick is to analyze either the CSS or XPath selector and optimize it so it's neither brittle nor a mile long. This is something I've learned to do by hand, but optimizing as I've indicated doesn't seem to be a part of the tools I've seen.

Also of note: Selenium was really designed for "Web 1.x" and doesn't assume the dynamic DOMs of today. Modern frameworks like Playwright are built with the understanding that the DOM is dynamic and are more robust. So - consider Playwright (or something like it - although I think it's "best of breed") vs. Selenium.

dzhar11|3 years ago

A long time ago, I worked on my Page Object Generator pet project, a desktop app allowing me to record/test page elements via Selenium Webdriver. https://github.com/dzharii/swd-recorder

It was a time when I had to test an IE6-only enterprise web tool, And there was no option to copy CSS-selector in Chrome/Firefox. I am not working in UI automation anymore (sad :( ) and lost interest in this project, but I think having a tool to record page objects and generate some smart automation code can still be quite helpful.

mesadb|3 years ago

That sounds awful I'm sorry :D

I'll drop you an email when we are able to launch it. Would love to get your feedback

notadev|3 years ago

I would absolutely pay for this, but only if it could work with web applications built in React. React generates CSS class/ID names, some of which are duplicates. This requires determining convoluted XPATHs which can very easily, and often do, change in ways that immediately break the pre-defined locators. I’m aware of using unique attributes to make elements easier to locate, but that often requires someone else’s buy-in which isn’t always a guarantee. Even having a way to run the application in a headless browser and generating the POM programmatically would be great.

jitl|3 years ago

Given that I don’t know what this is, and that Selenium’s API is well-known to promote flakey tests (it’s flakey by default and needs layers of abstractions to add waits, delays, etc), I’d stay away.

clarle|3 years ago

Aren't all E2E test frameworks flaky by default? When you're testing the end user experience that goes through multiple layers of services, I think that should be expected.

Would love to learn from your experiences on any better frameworks you might have used, though!

tailspin2019|3 years ago

Cypress completely solved flakey UI tests for me. I used Selenium for years but would never go back now.

sattoshi|3 years ago

Sounds somewhat similar to Dakka: https://www.dakka.dev/

mesadb|3 years ago

I have heard of this actually. It's a nice open source tool. But it doesn't have AI selectors no?

shyn3|3 years ago

Get DataDog. Launch their synthetic ux monitor.

Implement that for scraping and that would be great I think.

mesadb|3 years ago

Can I get your feedback on preflight.com vs Datadog?