I think you are missing out the definition of "Framework"
A framework is comprised of a combination of practices and tools that are designed to help QA professionals test more efficiently.
These guidelines could include coding standards, test-data handling
methods, object repositories, processes for storing test results, or
information on how to access external resources.
While these are not mandatory rules and testers can still script or
record tests without following them, using an organized framework
typically provides additional benefits that would otherwise be missed
So test frameworks are not just folder structures, it defines an overall process, tool, rules, technologies, coding standards, and so many stuff
Why we need a framework?
It makes code maintainability pretty easy. Once you have a framework that is efficient, you can code in parallel with high efficiency. For instance, you write code for drop-down selection and another engineer can reuse the code.
If you didn't have an efficient framework(naming convention and directory structure), the engineer should waste his/her effort in finding a solution that was already found out.
Why can't we reuse framework?
That is how all frameworks are being built,we take up existing frameworks and leverage it to create frameworks that are suitable for our project and team. For example TestNG, robot framework, etc.
All the test directory structures for UI tests are almost similar. Most uses page object model with folder structure like util, common, resource, report, etc. We just make changes according to different projects.
Why can't we have one fit solution?
The framework depends on organizational decisions and project complexity. For instance, the organization wants to save money by moving from VMS to containers. They want to run the selenium grid test in containers than in VMs, or sometimes the decisions may be to use the cloud.
So you have to investigate how the test-framework could be made ready for being put in CI/CD or delivering the additional requirements.
But in all cases, there will be a base framework from where we start building it.
And also test frameworks are company proprietary asset, it comes under intellectual property. You can't just share it with the public , the same as any other source code.
Have we ever asked like,
API solutions are already there, why can't we have a common solution to implement API, why can't we just copy paste a common API implementation and use it in our project. Why develop new APIs?
Why we need developers when you can simply have a common repository for components like link, button, logics, algorithms, etc. You can just copy and reuse it, then why reinventing the wheel.?
Its the same for test framework development, we start from a base and make changes according to our needs. We cannot just copy paste a single solution and use it as it is. Because things break and we have to make it work.
How to create an efficient framework ?
Start from the base framework, learn from mistakes, keep evolving the solutions.
Most importantly, fail fast, meaning that you should realize the inefficiency of your framework faster. Analyze the drawback and make changes quickly, grow your test suites slowly till you are confident about the implementation.
Any Frameworks recommendation ?
Framework depends on project, budget , organizational decisions and many such things. And as mentioned, frameworks are not just directory structure.
Recommendation for directory structure could be taken from GitHub or any such open source repos. But you have to develop it in the ways you need