#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
| # 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 |
| =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">
| # 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 | |
| } |
| # Add as Rake task or Rails console | |
| class CSVFormatter | |
| def initialize | |
| @buffer = [] | |
| end | |
| def result | |
| @buffer.join("\n") | |
| end |
| #!/usr/bin/env ruby | |
| # see: | |
| # https://w3c.github.io/webdriver-bidi/#command-browsingContext-print | |
| # https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF | |
| # https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/examples/print_example.py | |
| # https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/examples/_helpers.py | |
| require 'net/http' |