#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
| # Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
| # that enables you to choose a character from a menu of options. If you are on Lion | |
| # try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
| # for input. | |
| # | |
| # It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
| # it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
| # as it means you cannot press and hold h/j/k/l to move through your file. You have | |
| # to repeatedly press the keys to navigate. |
| class Fifo | |
| EmptyError = Class.new(Exception) | |
| Node = Struct.new(:value, :next) | |
| attr_accessor :size, :top | |
| private :size=, :top= | |
| def initialize | |
| self.size = 0 |
#Getting Started
##Webpage:
<html>
<head>
<title>Testing with Ruby and Selenium WebDriver</title>
</head>
<body bgcolor="antiquewhite">
| # Installation | |
| # | |
| # 1. Install Xvfb | |
| # | |
| # sudo apt-get install xvfb | |
| # | |
| # 2. Add this file to /etc/init.d/xvfb | |
| # | |
| # 3. Make the script execuable. | |
| # |
| // Promise.all is good for executing many promises at once | |
| Promise.all([ | |
| promise1, | |
| promise2 | |
| ]); | |
| // Promise.resolve is good for wrapping synchronous code | |
| Promise.resolve().then(function () { | |
| if (somethingIsNotRight()) { | |
| throw new Error("I will be rejected asynchronously!"); |
| //import the http library | |
| var http = require('http'), | |
| //npm install q before requiring it | |
| Q = require('q'); | |
| //a js object with options | |
| var googleNewsOptions = { | |
| hostname: 'ajax.googleapis.com', | |
| path: '/ajax/services/search/news?v=1.0&q=nodejs', | |
| method: 'GET' |