Perform automatic browser tests with RSelenium
Last updated
Last updated
Selenium is a classic tool for QA and it can help perform automatic checks on a website. This is an intro to how to use it
One of the great advantages of using Selenium is that you can alternate automatic and manual actions in the same session. For example, you can log on somewhere and run an automatic script after pretty easily or… fill in a captcha and run your script.
The first step is, as always, to install and load the RSelenium package
We’ll launch a selenium server with a Firefox browser in a controlled mode. It will take quite some time the first time but after it will load in a few seconds.
here is the R command:
Then we’ll grab the instance to be able to control our browser
It’s now possible to send action to our browser. To open a website URL just type
You will notice the robot head icon which means that it is a remote-controlled browser
Here are some useful commands:
When you are done with it, don’t forget to
Otherwise, it’s gonna be a mess when you’ll get back on it
You can check the documentation to learn all the functions to find DOM elements and actions but there is a quicker way:
Use a chrome extension like Katalon recorder, record and copy/paste the instructions directly
At the end of the process, it should open a firefox window like this one