Selenium webdriver, chromeDriver and Ruby on Windows
Tags: seleniumwebdriver, chromedriver, ruby, windows
Published: 2021-05-19 20:12:59

<!-- wp:separator -->
<hr class="wp-block-separator"/>
<!-- /wp:separator -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image"><figure class="aligncenter"><img src="https://cdn-images-1.medium.com/max/800/1*J2h4qahpj5B0RCBXHpEPLA.png" alt=""/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>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 Windows and the online tutorials were not very helpful.</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://cdn-images-1.medium.com/max/800/1*8I32s858-Xymbr56JY9zew.png" alt=""/><figcaption>Illustration of a non-helpful tutorial statement</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><a href="http://www.seleniumhq.org/" rel="noreferrer noopener" target="_blank">Selenium</a>&nbsp;is an open-source tool used to automate browsers.&nbsp;<a href="http://www.seleniumhq.org/" rel="noreferrer noopener" target="_blank">Their official website</a>&nbsp;contains tutorials and code snippets in various programming languages: java, csharp, python ruby, php, perl and javascript.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Below you can find a script 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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>MacOS Tutorial</strong>&nbsp;on how to install what is listed on the title of this article.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>#!/usr/bin/env bash<br>#!/usr/bin/env ruby<br>xcode-select — install<br>/usr/bin/ruby -e “$(curl -fsSL&nbsp;<a href="https://raw.githubusercontent.com/Homebrew/install/master/install" rel="noreferrer noopener" target="_blank">https://raw.githubusercontent.com/Homebrew/install/master/install</a>)"<br>curl&nbsp;<a href="http://chromedriver.storage.googleapis.com/2.24/chromedriver_mac64.zip" rel="noreferrer noopener" target="_blank">http://chromedriver.storage.googleapis.com/2.24/chromedriver_mac64.zip</a>&nbsp;&gt; /tmp/give_this_file_a_more_creative_name.zip<br>unzip /tmp/give_this_file_a_more_creative_name.zip -d /tmp<br>sudo gem install selenium-webdriver</p></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>This link is very helpful in order to put ChromeDriver location in your PATH environment variable:&nbsp;<a href="http://www.kenst.com/2015/03/installing-chromedriver-on-mac-osx/" rel="noreferrer noopener" target="_blank">http://www.kenst.com/2015/03/installing-chromedriver-on-mac-osx/</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Windows Tutorial</strong></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Download chromedriver_win32.zip&nbsp;<a href="https://chromedriver.storage.googleapis.com/index.html?path=2.30/" rel="noreferrer noopener" target="_blank">https://chromedriver.storage.googleapis.com/index.html?path=2.30/</a></li><li>Install Ruby version e.g — 2.2.6&nbsp;<a href="https://rubyinstaller.org/downloads/" rel="noreferrer noopener" target="_blank">https://rubyinstaller.org/downloads/</a></li><li>In order to put ChromeDriver location in your PATH environment variable do as follows:</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Right click computer &gt; properties &gt; system properties &gt;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Advanced &gt; System properties &gt; Select Path below &gt;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p> Edit &gt;Add the path</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>(if you are unsure of the path, you can right click the icon of the file and in the properties get the full path).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>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.&nbsp;<a href="https://www.youtube.com/watch?v=9kWz5tL4D7w" rel="noreferrer noopener" target="_blank">https://www.youtube.com/watch?v=9kWz5tL4D7w</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Extra</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>My favourite selenium resources when studying selenium with Ruby.</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>A free, once-weekly e-mail on how to use Selenium like a Pro: <a href="http://elementalselenium.com/"><strong><em>Elemental Selenium: Receive a Free, Weekly Tip on Using Selenium like a Pro</em></strong></a></li><li>Cheatsheet:&nbsp;<a rel="noreferrer noopener" href="https://gist.github.com/huangzhichong/3284966" target="_blank">https://gist.github.com/huangzhichong/3284966</a></li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->