#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
require 'pp' | |
require 'upwork/api' | |
# require 'upwork/api/routers/auth' | |
# require 'upwork/api/routers/organization/users' | |
require 'upwork/api/routers/jobs/search' | |
# step 1 | |
config = Upwork::Api::Config.new({ | |
'consumer_key' => 'x', | |
'consumer_secret' => 'x', |
# NOTE: Be sure to set the API key further down in the code! | |
require "net/http" | |
require "uri" | |
require "json" | |
class WIP | |
def initialize(api_key:) | |
@api_key = api_key | |
end |
require 'csv' | |
namespace :csv do | |
desc "generates a migration file from column names from the CSV headers" | |
task create_migration: :environment do | |
def headers_from_CSV (filename) | |
csv_header_array = CSV.read(filename, headers: true).headers | |
return csv_header_array.map { |col_a| col_a.strip.downcase.gsub(' ', '_').gsub('.', '_') } | |
end |
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
// optimized for rails | |
document.addEventListener("turbolinks:load", () => { | |
$('[data-toggle="tooltip"]').tooltip() | |
$('[data-toggle="popover"]').popover() | |
if (document.querySelector('#target-btn')) { | |
// start of the actual copy paste action | |
document.querySelector('#target-btn').addEventListener("click", (event) => { | |
var el = document.getElementById("target-table"); | |
var body = document.body, range, sel; |
# best practice: linux | |
nano ~/.pgpass | |
*:5432:*:username:password | |
chmod 0600 ~/.pgpass | |
# best practice: windows | |
edit %APPDATA%\postgresql\pgpass.conf | |
*:5432:*:username:password | |
# linux |
pb-kill-line () { | |
zle kill-line | |
echo -n $CUTBUFFER | pbcopy | |
} | |
pb-kill-whole-line () { | |
zle kill-whole-line | |
echo -n $CUTBUFFER | pbcopy | |
} |