

click # define a list of URLs to test urls = # loop through URLs urls. Drag and drop Android Studio into the Applications folder, then launch Android Studio. find_element ( :name, 'commit' ) element. 1 To install Android Studio on your Mac, proceed as follows: Launch the Android Studio DMG file. We'll test the install by running a simple automation s. send_keys 'super_secret_password' # click submit button element = driver. This tutorial will show you how to install and setup Selenium WebDriver with Maven and Java on a Mac. find_element ( :id, 'user_password' ) element. send_keys # enter password element = driver. find_element ( :id, 'user_email' ) element. to '' # enter user in username field element = driver. Notice how the google screenshot was from an unauthenticated user? Here’s another script that authenticates first, hits a list of urls, and takes a screenshot of each page: #!/usr/bin/env ruby # includes require 'selenium-webdriver' require 'uri' # create new chrome webdriver driver = Selenium :: WebDriver. Made the file executable, and executed it: $ chmod +x test.rbĪ screenshot was created in the working directory. save_screenshot ( 'google.png' ) # close webdriver driver. I created a new file “test.rb”: #!/usr/bin/env ruby # includes require 'selenium-webdriver' # create new chrome webdriver driver = Selenium :: WebDriver.

Now you’re ready to write some ruby code. # copy chromedriver into $PATH $ sudo cp chromedriver /usr/bin/ Download and configure Eclipse or any Java IDE of your choice. # download chromedriver # url: # chromedriver_mac_.0.zipĜhromeDriver server for mac # example: $ curl -O Download and Install Java 8 or higher version. Applications/Google Chrome.app/Contents/MacOS/Google Chrome: Mach-O executable i386 # ensure Google Chrome is installed in the correct location $ file /Applications/Google \ Chrome.app/Contents/MacOS/Google \ Chrome # install selenium-webdriver gem $ gem install selenium-webdriver # create add a new gemset (optional) $ echo "rvm use -create >.

# create a new project space $ mkdir selenium_testing

In this tutorial I’ll show how to use the Selenium webdriver with Chrome and Ruby code to execute automated website tests and take screenshots along the way. Automated browser testing with screenshots on Mac OSX using Ruby and Selenium
