A good software development process involves thorough testing phases, that are usually expensive, but necessary to deliver a reliable and high quality product. Testing an application via its graphical user interface requires lots of manual work, even if some steps of GUI testing can be automated. Test automation tools are a great help for testers, particularly for regression tests. However these tools still lack some important features and still require manual work to maintain the test cases. For instance, if the layout of a window is changed without affecting the main functionality of the application, all test cases testing the window must be re-recorded again. This hard maintenance work is one of the greatest problems with the regression tests of GUI applications. In our paper we propose an approach to use the GUI information stored in the source code during automatic testing processes to create layout independent test scripts. With this technique, the already recorded tests scripts will be unaffected by minor changes in the GUI. It reduces the maintenance effort of very expensive regression tests where thousands of test cases have to be maintained by testing teams. The idea was motivated by testing an application developed in a fourth generation language, Magic/uniPaaS. In this language the layout of the GUI elements (structure of the window, position and size of controls, etc.) are stored in the code and it can be gathered via static code analysis. We implemented the presented approach for Magic/uniPaaS, and our Magic Test Automation tool is used by our industrial partner who has developed applications in Magic/uniPaaS for more than a decade.