This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The class 'Cat' defines the blueprint of what an instantiated Cat | |
# object will eventually look like. In this case, a Cat object would | |
# have two attributes (name and color), and one function (or verb) that | |
# can be called on that object (eat_food). | |
class Cat | |
# Attributes that describe the Cat class. | |
attr_reader :name | |
attr_reader :color |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Helper for accessing window.bt.listings.models object on page. Uses detail_attribute | |
# param to access specific field on found property's details object. | |
def property_detail_attribute(detail_attribute) | |
detail_script = <<-CMD | |
matched_property = | |
$.grep(window.bt.listings.models, | |
function(m) { | |
return m.id == #{@property_id}; | |
})[0]; | |
if (matched_property) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# McDonalds Example -------------------------- | |
class McDonalds | |
def initialize(location) | |
@location = location | |
end | |
def get_location | |
return @location |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
In the example below, attempting to access the individual input element in | |
the second div is possible using an ancestor/descendant selector. If we | |
only selected the input with the class "test_class" with: | |
document.querySelector('input.test_class'); | |
We wouldn't be guaranteed to receive a unique element, as this selector | |
would match both input elements. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WebDriver API Examples | |
driver = WebDriver.new('Chrome') | |
# Example of sending keystrokes to an input field. | |
input_el = driver.find_element(<some_input_selector_goes_here>) # <-- Returns an instance of the WebElement class. | |
input_el.send_keys('Hey') # <-- Sends keystrokes to the retrieved input WebElement object. | |
# Example of clicking a button. | |
button_el = driver.find_element(<some_button_selector_goes_here>) # <-- Returns an instance of the WebElement class. | |
button_el.click() # <-- Clicks the retrieved button WebElement object. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'selenium-webdriver' | |
begin | |
driver = Selenium::WebDriver.for :chrome | |
driver.get 'http://google.com' | |
search_input_field = driver.find_element(:id => 'lst-ib') # Returns an instance/object of the WebElement class. | |
search_input_field.send_keys('Ryan Buff') | |
ensure | |
driver.quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TodoItem | |
attr_reader :name | |
attr_accessor :status | |
def initialize(arg1) | |
@name = arg1 | |
@status = false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
require 'rack' | |
# http://recipes.sinatrarb.com/p/embed/event-machine | |
class WebService < Sinatra::Base | |
def initialize(test_obj) | |
super() | |
@test_obj = test_obj | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developers.google.com/web/updates/2017/04/headless-chrome | |
const fs = require('fs'); | |
const {Builder, By, Capabilities, Key, until} = require('selenium-webdriver'); | |
const chromedriver = require('chromedriver'); | |
const chromeCapabilities = Capabilities.chrome(); | |
chromeCapabilities.set('chromeOptions', {args: ['--headless']}); | |
async function test() { | |
// Note: On macOS, you'll likely see a new Chrome process flash on your 'Dock' | |
// when this new driver object is built. As it's launched headlessly, it's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import sys | |
import time | |
# Script param validation. | |
def validate_params(): | |
param_error_found = False | |
if len(sys.argv) < 3: | |
param_error_found = True | |
if sys.argv[1].lower() not in ['qa0', 'qa1', 'qa2', 'qa3', 'qa4', 'qa5', 'qa6', 'qa7', 'qa8', 'qa9', 'qa10']: |
OlderNewer