I’m currently exploring automated testing for Odoo using Robot Framework with Playwright, and I’d love to hear from people who have already worked on a similar setup.
If you’ve implemented this kind of testing, I’d be interested in hearing about your experience, particularly:
Selectors: What types of selectors have you chosen (CSS, XPath, text, roles, test IDs, etc.)? Which ones have worked best for you?
Maintainability:Given that Odoo evolves with each new version, how do you keep your tests maintainable and avoid having to rewrite them whenever you upgrade?
Challenges:What issues or roadblocks did you encounter when setting up the testing environment or writing your first tests?
Best practices:Any tips, recommendations, or lessons learned that you wish you had known before getting started?
I’m particularly interested in real-world feedback rather than just theoretical recommendations.
I’ve only written a few simple tests against Odoo’s community edition as a POC, I used a mix of CSS and xpath selectors (which ever was easier).
Odoo is a browser based app so either SeleniumLibrary or Browser Library will be fine as I don’t remember any shadow dom’s or iframes or other tricky stuff like that.
I just had a quick look over my POC script and it looks like I used xpath when I was selecting and element by it’s name mostly buttons and spans (probably tabs or menus) and elsewhere I used the name attribute either directly as a name selector or in a css selector. it was a few years ago so I guess that’s because the :has:has-text psudo selectors in in Browser library’s CSS selectors don’t work in devtools and I would have just quickly tested what ever selector worked in devtools and pasted it into my keyword.
Thanks a lot for sharing your experience! That’s really helpful.
I have two follow-up questions, if you don’t mind.
First, how did you usually identify and inspect the selectors you used? Did you rely mainly on browser DevTools (Inspect Element), or did you use any other tools or techniques to find reliable selectors in Odoo?
Also, since Odoo’s DOM structure and frontend components can change between major versions, did you ever consider creating an abstraction layer for your selectors (for example, centralizing them in resource files or reusable keywords) to make maintenance easier?
Or would you simply update the selectors whenever a test breaks after an upgrade?
Thanks again for taking the time to share your experience!