When I worked in Quality Assurance, one of my jobs was to do regression testing on a number of websites. At that time there were only limited automation tools, so my solution involved the Java Robot class to issue mouse and key events. This was of course incredibly fragile.

More recently, automating web browser interactions have become much easier. The WebDriver protocol specifies a really nice set of commands and interactions to talk to a browser. The Wolfram Language (WL) uses this protocol to let you control browsers directly from a notebook session. The interactive nature of a notebook is extremely nice to incrementally develop web automation workflow. In this story, I will show you how to get started with this functionality.

To start a new web browser session, you use the StartWebSession command. Without function arguments, it will start a Chrome browser on your computer. The Firefox browser is also supported.

Image for post

(image by author)

To open a web page you can use the WebExecute command. This command is the main function you use to control the web browser. You specify the session and you give it a command like “OpenWebPage”, “ClickElement”, or “JavascriptExecute”:

#quality-assurance #programming #web-testing #wolfram #webdriver

Learning Wolfram: Interacting With Web Browsers
1.45 GEEK