Skip to content

Instantly share code, notes, and snippets.

require 'operawatir/helper'
describe 'Frames in Watir 3' do
it 'as a block' do
window.frame(:id => 'foo') do |frame|
frame.p(:id => 'bar').should include 'bar'
end
end
require 'rubygems'
require 'deprecated'
class Foo
include Deprecated
def foo
"foo"
end
require 'operawatir/helper'
describe 'Button' do
it 'updates paragraph' do
browser.goto "data:text/html;charset=utf-8,%3C!doctype%20html%3E%0D%0A%3Cmeta%20charset%3D%22utf-8%22%20%2F%3E%0D%0A%3Ctitle%3EButton%3C%2Ftitle%3E%0D%0A%0D%0A%3Cbutton%20id%3D%22test%22%20onclick%3D%22document.getElementById('result').innerHTML%20%3D%20'PASS'%22%3EClick%20me%3C%2Fbutton%3E%0D%0A%0D%0A%3Cp%20id%3D%22result%22%3EFAIL%3C%2Fp%3E%0D%0A"
browser.button(:id, 'test').click_no_wait
browser.p(:id, 'result').should include 'PASS'
end
end
require 'watir-webdriver'
browser = Watir::Browser.new :firefox
browser.goto 'http://www.carritus.com/'
browser.span(:text => 'Bebidas').when_present.click
browser.span(:text => 'Cervezas').click
browser.span(:text => "Importación").click
puts browser.url
.//input[(not(@type) or (@type!="file" and @type!="radio" and @type!="checkbox" and @type!="submit" and @type="reset" and @type!="image" and @type!="button" and @type!="hidden" and @type!="url" and @type!="datetime" and @type!="date" and @type!="month" and @type!="week" and @type!="time" and @type!="datetime-local" and @type!="range" and @type!="color")) and @name='q'] | .//textarea[@name='q']
require 'rubygems'
require 'operawatir'
browser = OperaWatir::Browser.new
browser.goto 'http://maps.google.com/?hl=en'
puts 'Find the search box'
search = browser.text_field(:id, 'q_d')
puts 'Type text and submit the form'
import com.opera.core.systems.OperaDriver;
import com.opera.core.systems.OperaWebElement;
import org.openqa.selenium.By;
//import org.openqa.selenium.WebElement;
public class MyTest {
public static void main(String[] args) throws InterruptedException {
OperaDriver driver = new OperaDriver();
input-button.rb:
OS X:
Finished in 10.19 seconds
35 examples, 7 failures
operawatir input-button.rb 11.47s user 0.90s system 81% cpu 15.137 total
GNU/Linux:
require 'operawatir/helper'
describe 'OperaWatir' do
describe 'Browser' do
describe '#select_list' do
before :each do
browser.goto 'http://t/core/standards/wf1/interactive/button-type-reset-012.html'
@select_list = browser.select_list(:name, 'test')
@reset = browser.button(:name, 'reset')
end
require 'rubygems'
require 'operawatir'
describe OperaWatir do
before(:all) do
OperaWatir.api = 3
@browser = OperaWatir::Browser.new
@browser.url = 'http://people.opera.com/weic/temp/wml.wml'
@window = @browser.active_window
end