Skip to content

All languages I short to the first letter

  • Ruby = R
  • Python = P
  • Java = J

With certain tools I do the same

  • Lapis Lazuli = LL
  • Robotframework = RF

Starting a browser session

1
2
require "selenium-webdriver" 
driver = Selenium::WebDriver.for :firefox
1
2
require 'watir'
browser = Watir::Browser.new :firefox
1
2
3
4
# Start IRB session in a folder that contains a LL project
require 'lapis_lazuli'
include LapisLazuli
browser :firefox
1
2
from selenium import webdriver
driver = webdriver.Firefox()
1
2
from nerodia.browser import Browser
browser = Browser(browser='chrome')
1
2
3
4
5
6
*** Settings ***
Library    SeleniumLibrary

*** Test Cases ***
Scenario: Google Example
    Open Browser http://www.google.com chrome
1
// needs an example

Starting a remote browser session

1
2
require "selenium-webdriver"
driver = Selenium::WebDriver.for :remote, url: "http://myserver:4444/wd/hub"
1
2
require 'watir'
browser = Watir::Browser.new :firefox, url: "http://myserver:4444/wd/hub"
1
2
3
4
5
6
# Start IRB session in a folder that contains a LL project
require 'lapis_lazuli'
include LapisLazuli
browser :firefox, {
    url: "http://myserver:4444/wd/hub", 
}
1
Example needed
1
Example needed
1
Example needed
1
Example needed

Browser interaction (navigation)

1
driver.navigate.to "https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings"
1
browser.goto 'watir.com'
1
browser.goto 'testautomation.info'
1
driver.get('https://python.org')
1
browser.goto('https://nerodia.readthedocs.io/en/latest/')
1
Example here
1
// needs an example

Browser title

1
driver.title
1
2
browser.title # Watir
browser.driver.title # Selenium
1
browser.title # Watir
1
Example here
1
browser.title()
1
Example here
1
// needs an example

Browser maximizing

1
# Example here
1
browser.window.maximize
1
browser.window.maximize  # Watir
1
Example here
1
browser.window().maximize()
1
Example here
1
// needs an example

Browser Quit/Close

1
2
driver.close
driver.quit
1
2
browser.close
browser.quit
1
2
browser.close # Watir
browser.quit  # Watir
1
2
driver.close()
driver.quit()
1
2
browser.close()
browser.quit()
1
Example here
1
2
driver.close()
driver.quit()