Selenium-webdriver + ChromeDriver + Ruby on Windows

SELENIUM-WEBDRIVER + CHROMEDRIVER + RUBY ON WINDOWS
0

Automating tasks you have to do over and over can be very helpful. I have been doing that on MacOS but I had the need to do it on a Windows OS and the online tutorials were not very helpful.

Selenium is an open-source tool used to automate browsers. Their official website contains tutorials and code snippets in various programming languages: java, csharp, python ruby, php, perl and javascript.

Below you can find tutorials for MacOS and Windows on how to install Selenium-web driver, Chrome Driver and Ruby. Please note I chose a specific version for each, but feel free to pick the one that makes more sense to you.

MacOS Tutorial on how to install what is listed on the title of this article.

#!/usr/bin/env bash
#!/usr/bin/env ruby
xcode-select — install
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
curl http://chromedriver.storage.googleapis.com/2.24/chromedriver_mac64.zip > /tmp/give_this_file_a_more_creative_name.zip
unzip /tmp/give_this_file_a_more_creative_name.zip -d /tmp
sudo gem install selenium-webdriver

This link is very helpful in order to put ChromeDriver location in your PATH environment variable: http://www.kenst.com/2015/03/installing-chromedriver-on-mac-osx/

Windows Tutorial

1- Download chromedriver_win32.zip https://chromedriver.storage.googleapis.com/index.html?path=2.30/
2- Install Ruby version e.g — 2.2.6 https://rubyinstaller.org/downloads/
3- In order to put ChromeDriver location in your PATH environment variable do as follows:

Right click computer > properties > system properties > Advanced > System properties > select Path below > edit > add the path (if you are not sure of the path, you can right click the icon of the file and in the properties get the full path).

This video is very helpful to see this step-by-step however it is of an older windows versions, so you have to adapt to the one you’re currently using. https://www.youtube.com/watch?v=9kWz5tL4D7w

Extra:

My favourite selenium resources when studying selenium with Ruby:
A free, once-weekly e-mail on how to use Selenium like a Pro
Elemental Selenium: Receive a Free, Weekly Tip on Using Selenium like a Pro

Elemental Selenium: Receive a Free, Weekly Tip on Using Selenium like a Proelementalselenium.com
2. Cheatsheet: https://gist.github.com/huangzhichong/3284966

About the Author:
Amanda is a computer scientist, currently working as a ruby developer, a Women TechMakers co-lead and a GDG Cloud London co-organiser.