[HN Gopher] Ask HN: Would you be interested in POM generator for...
       ___________________________________________________________________
        
       Ask HN: Would you be interested in POM generator for Selenium?
        
       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?
        
       Author : mesadb
       Score  : 14 points
       Date   : 2022-06-11 15:18 UTC (7 hours ago)
        
       | jmll wrote:
       | 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 :)
        
         | mherrmann wrote:
         | Regarding automatic selectors: check out my open source library
         | https://github.com/mherrmann/selenium-python-helium.
        
         | Etheryte wrote:
         | The DOM timeline you describe would be pretty straightforward
         | to create using a MutationObserver [0]. It's available in all
         | major browsers.
         | 
         | [0] https://developer.mozilla.org/en-
         | US/docs/Web/API/MutationObs...
        
       | lloydatkinson wrote:
       | 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 wrote:
         | 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.
        
           | zirror wrote:
           | Yes, way more stable. At least cypress, I don't have much
           | experience with playwright. We never had an issue regarding
           | brittleness or stability. We do, however, get sometimes
           | frustrated over certain API choices, like the way sessions
           | and cookies are managed and how hard it is to keep a value
           | throughout a test suite etc.
        
       | jitl wrote:
       | 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 wrote:
         | 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!
        
           | dude01 wrote:
           | Yeah, Selenium is pretty flakey. I've been pretty happy with
           | https://playwright.dev . Kind of the successor of puppeteer.
           | At least, some of the same devs went from Google to MS.
           | Here's an example where MS has better cross-browswer support
           | than Google.
        
           | azemetre wrote:
           | No not all e2e frameworks are flakey. Cypress allows you to
           | intercept network calls with ease. The same can be done in
           | Playwright as well.
        
           | jicea wrote:
           | We're using Hurl [1] at work for integration tests with very
           | good success. We've eliminated false positive or flacky
           | tests: it's a simple tool that runs HTTP requests and you can
           | add asserts on responses.
           | 
           | It's as if you would test your app with curl, very fast and
           | reliable. On the other hand, contrary to Selenium, there is
           | no Javascript engine so you can only test the "raw" DOM or
           | json response sent by the network (and not a DOM managed and
           | rendered by a Javascript front end framework).
           | 
           | (Disclaimer: I'm one of Hurl maintainer)
           | 
           | [1]: https://hurl.dev
        
             | brimstedt wrote:
             | Seems hurl is quite a different thing than browser
             | automation though?
             | 
             | API/request level testing is great when appropriate, but
             | testing what happens in browser won't be possible without
             | using something like selenium, nightwatch or playwright
        
               | jicea wrote:
               | Yes totally.
               | 
               | On the other hand, you can also easily test use cases
               | where the browser is "helping" you (for instance, you
               | want to test that your backend didn't accept an invalid
               | email, but your HTML form has HTML5 validation that
               | prevents a user to enter an invalid email). Or you want
               | to test HttpsOnly cookie attributes. But it can't do UI
               | integration tests.
        
       | speps wrote:
       | POM = Page Object Model[1]
       | 
       | [1] https://www.browserstack.com/guide/page-object-model-in-
       | sele...
        
         | mhb wrote:
         | Why would someone not spell that out in the title, I wonder.
        
           | abirch wrote:
           | I'm wondering why people would want the Project Object Model
           | for Java.
        
       ___________________________________________________________________
       (page generated 2022-06-11 23:01 UTC)