How would you design and build a test automation framework from the ground up for a complex web application?