Web applications such as web-based email, spreadsheets and form filling applications have become ubiquitous. However, many of the tasks that users try to accomplish with such web applications are highly repetitive. In this paper we present the design of a system we have developed that learns and thereafter automates users’ repetitive tasks in web applications. Our system infers users’ intentions using an ensemble of decision trees. This enables it to handle branching, generalization and recurrent changes of relative and absolute positions. Our evaluation shows that our system converges to the correct solution after 3–8 iterations when the pattern is noise-free, and after 3–14 iterations for a noise level between 5–35%. Author Keywords End-user programming, programming by example ACM Classification Keywords I.2.2. Automatic Programming: Program synthesis. I.5.5. Implementation: Interactive systems. General Terms Algorithms, Design, Experimentation, Human Factors