Robot Framework is built with Python. See how to install that first.
- [Instructor] Since Robot Framework was developed using the Python language. The most common way to install it and use it is with Python as a foundation on the computer. So the first thing we're going to do is to install Python and PIP. The way we do that is to navigate to Python.org. And at the moment they have a Downloads link but that may change to something different in the future. Once you're there you're going to have to decide which Python version to use and download it. For many years we only used Python Version 2.7.X with Robot Framework but Robot Framework has recently been refactored to support Python 3, so it is possible to use that now.
I will say that if you choose to use Python 2.7.X, you're guaranteed to have a smooth experience with Robot Framework regardless of which library you decide you need to use. But on the other hand Python 2 support is going to stop by 2020. So I do recommend trying to use Python 3 if you can. For this course I'm going to show you how to install using Python 3. But if you've been using Robot Framework with Python 2 and you have some existing scripts, obviously I recommend that you try using Python 3 on a new machine separately to make sure your scripts work with it before you change all your computers over to Python 3.
So let's go get this installer and get started. So I've got a browser open, I'm going to python.org and hitting return. Click on that Downloads link. And you'll notice right off the bat, there's a button to download Python 3.6.5. I'm pretty sure this will only allow us to install a 32-bit version of Python. So what I'm going to do is hover over Downloads and instead I'll click on this View the full list of downloads. And as we scroll down we see that there is a Python 3.6.5 here.
So I'll click on that link. And as we scroll down towards the bottom of the page, there's information for Windows users, macOS users and so on. So further down towards the bottom, there's a Windows x86 64 executable installer. So I'll click on that link and I'm going to save the installer to my local drive in case for some reason the installation doesn't work, I can rerun it. And on my C: drive I usually save that in a folder called Installers, and then maybe a Python subdirectory.
So I'll click to save that installer. And once it's done I'll click to open the folder. And like our slide says we're going to run the Python installer as administrator. And we're going to make sure that we select the PATH and pip options. So I'll right click and Run as administrator, clicking yes on any user account control dialogues. And like I said down here at the bottom, I'm going to click on this checkbox to Add Python 3.6 to PATH. And I'll click on Customize installation just to see what it's going to do.
You can see we're going to get Documentation, we're getting pip which is what we need for doing Robot Framework installations, and then the rest of this stuff as well. So I click on next and what I used to do for Python 2 is to Install for all users, and that used to work fine. But Windows is forcing us more and more to not install things near the root of the C: drive, instead forcing us into things like C: users Bryan and a deeper path like this. When I tried installing Python 3 for all users I got some permissions issues when I was trying to use pip to install the Robot Framework packages.
And that problem didn't occur when I just used this default directory for installing Python. So if you do want to install for all users, be prepared to try to work around some of those permissions issues. For now I'm just going to leave all this set as the default. But I'm going to select and copy this path and go back and check to make sure the directories are there after the installation is complete. So I click install, and the installer does it's work. Once the installers done, it offers an online tutorial so go ahead and click on that link if you want to check that out, but otherwise we can click on Close.
And I'm going to open up a new directory and paste that path in and hit return. And this is just a to visually verify that all the Python directories are here. If you double click on Scripts, this is where the pip executables live that we're going to use for installing Robot Framework. So the slide says to verify that those directories exist and also verify that the python directories are in PATH. And of course you can do that by going to this PC and right clicking. Selecting Properties, Advanced system settings, Environment Variables button.
And unlike previously when would install Python for all users, it doesn't actually show up in Path but it does show up here under User variables for blamb. You can see that in this Path here, we've got our Python36 and Python36 Scripts directories. It's just now they're in my user account path instead of the global system path that's used for all users. So I'll click on OK. And close that up.
It says we can open a command line and type in Python -V and pip -V. So I'll type in cmd to open a command line. Type in python -V, and you can see we have Python version 3.6.5. Now I'll type in pip -V and hit return, and we have pip 9.0.3. So you can see that this final step down here says type in pip list and follow the pip upgrade directions.
When you install Python and pip, sometimes you get an old version of pip. So I'm just going to type in pip list and hit return. And you can see it's telling us which packages are currently installed. And it's giving us a deprecation warning and also it says you're using an old version of pip. So it gives us the command right there that we can use to upgrade pip. So we'll just type that in verbatim. Python -m pip install --upgrade pip and hit return.
And that is it, we have successfully installed Python and pip which is going to allow us to use pip to install Robot Framework and the Robot Framework libraries we'll be using for our scripting.
- What's a test automation framework?
- Robot Framework vs. Selenium
- Creating and running your first script
- Options for running scripts, including PyCharm and Jenkins
- Making a script more readable
- Using variables to centralize data
- Incorporating the Page Object Model
- Robot Framework libraries