Robot Framework vs. Selenium

A free video tutorial from Bryan Lamb
My courses will improve your life and income!
Rating: 4.5 out of 1Instructor rating
12 courses
117,469 students
Robot Framework vs. Selenium

Learn more from the full course

Robot Framework Test Automation - Level 1 ( Selenium )

Fastest & easiest way to do Selenium test automation! Mobile test automation, API test automation, and database too.

06:27:57 of on-demand video • Updated December 2021

Install & configure the Robot Framework test automation tool plus libraries like Selenium, API, database, and more
Create & run your first Robot Framework test automation script (Selenium Webdriver example)
Understand the basics of many Robot Framework test automation libraries (Selenium Webdriver, API, Database, XML, Files, etc.)
Use the page object pattern to create more reusable, easier to interpret test automation scripts
Run/execute Robot Framework automated tests in many different ways, including from a command window, batch files, Jenkins, and Windows task scheduler
Create user defined keywords to express your tests in business domain terms instead of cryptic Selenium Webdriver code
English [Auto]
A question that comes up a lot when I talk about robot framework is why should I use a robot framework versus a MUNYON? Well, that's not really a valid question, because robot formwork, in a sense, is selenium, because it's a an abstraction layer or a wrapper on top of slam. You can see here that I have this script robot file at the top and it is capable of interacting with any of these libraries shown below. So if you decide your script wants to do selenium testing, you simply load up that selenium to library that's highlighted in yellow and start writing simple keywords to create your script. So let's see a specific example of this. This is a typical selenium test. And you can see up there at the top, we've added a bunch of using statements that bring features into the file we're trying to work with. Then we've got a namespace and we have a class and then we have a main function and then a bunch of C sharp code here where we're doing up variables and using C sharp syntax to spin up a new Firefox Web driver. And we're going to navigate it to Bing Bing to maximize the window. We're going to identify an input field. We're going to type in some keys and then we're gonna have the energy to submit that search and then we're gonna close the window. Now, what's interesting about this is that in order to use different browsers, you'd have to bring in a different using statement for a different Web driver. And then the test, you'd have to specify somehow which Web driver you want to use in some kind of a selection statement here so you can see the very Akua person who doesn't have any existing programming skills. This is a pretty steep learning curve. By contrast, this is what a robot framework web test looks like. You can see at the top here. I have one line that says I want to bring in the Slonim to library. Then I create the name of my test case. There's no classes or names, faces or anything like that. Just the name of my test case. And then the beginning of each of these lines is a slonim to keyword. So I can say open the browser and I can pass in two different pieces of information to that. And I can say wait until page contains and pass in what I'm waiting for. Then use input, text and pass in the locator and what I want to input, then click a button, I pass in the locator to click that button and sleep here. I just have that in there to keep the window open so we can see it. And then finally, close browser. So at its simplest, you can see that robot farmwork is a very easy, key, word driven language to use. Taking it a step further, we can see what a more formal example looks like. And in this example, I'm comparing it to Cucumber, which uses the Gurkin syntax. So you can see we have a little bit more up top here, including my documentation. I'm adding into resources that these test cases depend on. I've got test set up and test tear down. And then each of my test cases and you can see here I'm using the Gurkin syntax. Given users not logged in when the user searches for products, then search results contains relevant products. So robot farmer can do Gurkin similarly to the way Cucumber can. So hopefully you can see here that by using robot framework, you can produce very easy to read test cases very easily and you can test a wide variety of things instead of just web like selenium does.