Selenium comes in many flavours – really programming languages, and my recent encounter with Python pushed me in the direction of trying what I had developed in Java and C# in Python. Due to the nature of my job and projects, I get the nudge to learn new programming languages and that has afforded me the opportunity to embrace many of them like Java, C#, Python, Groovy, Javascript, PHP, Ruby and more recently Scala. I am currently reading the Scala in Action book and will attempt to create a Selenium framework in Scala. Before I do that, I will go the way of Python for basic setup and a quick test in Selenium.
First and foremost, let talk about the development environment. I love Macs! They make my life easy and cool. I will be setting up the Selenium (WebDriver) framework using GIT as my source control management tool.
Tools
- Terminal
- Homebrew
- Pip
- GIT
- Python IDE : PyCharm, Aptana, Eclipse – the choice is yours. PyCharm is my choice.
- Jenkins
Setup
On your Mac, open a terminal session, type in brew
. You should get some error message if Homebrew is not already installed. If Homebrew is not installed, fire up your browser and rush down to BREW to get your Mac brewed. Follow the steps and you should have that lovely tool up and running on your machine. Once installed, run the command: brew update
.
It should inform you your machine has nothing installed via Brew…or something similar.
That’s your first taste of brew (I don’t drink by the way).
To keep your machine always upto date, I have a very basic BASH script in GitHub. It does the job.
Next on the agenda is getting the IDE installed. That’s simple, in your browser, go to JetBrains. Download the community version and you should be fine. Once installed, move to the next step.
Back to the terminal, let’s install Pip, a Python package manager.