rplaywright: Bridging Playwright to R for Reproducible Web Automation in Research
Abstract
Dynamic web content plays an important role in research, from accessing public dashboards to automating testing workflows. However, R users face challenges when working with JavaScript-heavy websites, as most available tools rely on static HTML scraping or browser automation approaches that can be difficult to integrate smoothly into R workflows.To address these challenges, rplaywright (https://erikaris.github.io/rplaywright/) was developed to integrate the R environment with Microsoft’s Playwright, a browser automation framework used across multiple programming languages. The package enables automated interaction with Chromium, Firefox, and WebKit browsers, operating in either headless or visible modes. It supports tasks such as navigating web pages, scrolling through dynamically loaded content, completing online forms, and extracting information from sites that update dynamically. Features including automatic waiting for page components, handling of infinite scrolling, and reliable interaction with dynamic interfaces facilitate reproducible workflows for research involving web resources.rplaywright facilitates the seamless integration of dynamic web content into R-based research workflows, supporting scalable and reproducible data collection from interactive web portals. The project originated as part of the rOpenSci Champions Program, emphasising open development and community-driven technical mentorship. The package is suitable for workflows involving interactive data portals, social media platforms, and dynamic dashboards, enabling researchers to programmatically navigate pages, interact with filters, and extract underlying data for analysis. This poster will present the architecture of rplaywright, highlight key design considerations, demonstrate integration with popular R packages for streamlined analysis, and explore how cross-language tools can extend R’s capabilities to enhance research outcomes.Acknowledgements This project was initiated through my participation in the rOpenSci Champions Program 2024 (https://ropensci.org/blog/2024/02/15/champions-program-champions-2024/). I thank the rOpenSci team for their guidance and feedback throughout the development process. No external funding was received for this work.