A Reinforcement Learning Approach to Guide Web Crawler to Explore Web Applications for Improving Code Coverage

Chien-Hung Liu,Shingchern D. You,Ying-Chieh Chiu
DOI: https://doi.org/10.3390/electronics13020427
IF: 2.9
2024-01-20
Electronics
Abstract:Web crawlers are widely used to automatically explore and test web applications. However, navigating the pages of a web application can be difficult due to dynamic page generation. In particular, the inputs for the web form fields can affect the resulting pages and subsequent navigation. Therefore, choosing the inputs and the order of clicks on a web page is essential for an effective web crawler to achieve high code coverage. This paper proposes a set of actions to quickly fill in web form fields and uses reinforcement learning algorithms to train a convolutional neural network (CNN). The trained agent, named iRobot, can autonomously select actions to guide the web crawler to maximize code coverage. We experimentally compared different reinforcement learning algorithms, neural networks, and actions. The results show that our CNN network with the proposed actions performs better than other neural networks in terms of branch coverage using the Deep Q-learning (DQN) or proximal policy optimization (PPO) algorithm. Furthermore, compared to previous studies, iRobot can increase branch coverage by about 1.7% while reducing training time to 12.54%.
engineering, electrical & electronic,computer science, information systems,physics, applied
What problem does this paper attempt to address?
### Problems Addressed by the Paper This paper aims to address the challenges faced by web crawlers in exploring and testing dynamic web applications, particularly in improving code coverage. Specifically: 1. **Input Data Generation Problem**: Existing web crawlers typically rely on randomly generated or manually prepared input data when exploring dynamic web applications, leading to inefficiency and high costs. 2. **Insufficient Code Coverage Problem**: To effectively test an application, it is necessary to select appropriate input values and click sequences to maximize code coverage. Existing methods struggle to achieve this efficiently. To solve these problems, the authors propose a reinforcement learning-based approach by training a Convolutional Neural Network (CNN) agent (named iRobot) to autonomously select actions to guide the web crawler, thereby improving code coverage. Experimental results show that this method improves branch coverage by approximately 1.7% compared to traditional methods, while reducing training time to 12.54%.