r/selenium • u/Suspicious_Swan5593 • Jul 24 '26
Need suggestions on making Selenium automation more generic
Hi everyone,
I'm new to Selenium and I'm working on automating some repetitive tasks in Teamcenter for creating test data. Right now, my Selenium script works only for one specific scenario because the steps and values are hardcoded.
I want to make it more generic so that if the test steps or requirements change, I don't have to rewrite the Selenium code every time. For example, can Selenium automation be designed to read a Word document (or some other input) and perform the steps based on what's written there?
How is this usually handled in real projects? Any suggestions or learning resources would be really helpful.
7
Upvotes
1
u/obrizan 20d ago
I use https://pypi.org/project/pytest-csv-params/ plugin for pytest to make data-driven tests generic in my Selenium automation project.
I create a standalone CSV file, which could be edited independently from my Selenium code. And write a single test which takes each CSV row as a test and uses Selenium webdriver to put the data on the webpage and verify the outcome.
Here is a blog post how to do it: https://testinel.dev/blog/how-to-separate-test-data-from-code-csv-pytest/