watir

Is it possible to run Watir test in parallel?

故事扮演 提交于 2019-12-11 02:36:53
问题 I have simple Watir tests. Each test is self-contained, no shared state or dependency of any kind. Each test open and close the browser. Is it possible to run the test in parallel to reduce the time to run all tests? Even only 2 or 3 tests in parallel can reduce the time dramatically. 回答1: Take a look at parallel_tests Ruby gem. Depending on your setup, running the tests in parallel could be as simple as this: parallel_cucumber features/ 来源: https://stackoverflow.com/questions/19208060/is-it

Watir Help: click-no-wait and execute_script not working as expected

爱⌒轻易说出口 提交于 2019-12-11 02:06:35
问题 Using ruby's Watir gem, I'm trying to click a button that opens a javascript popup, then click 'ok' on the popup and I can't seem to do that. The button is in a frame in a frame. I have searched extensively and read the Watir wiki entry about javascript popups but nothing works. I think this is because execute_script and click_no_wait are not working as expected. For example, the following commands: @browser.execute_script('window.alert = function() {}') @browser.execute_script('alert("hello"

Watir Webdriver Load Chrome Extension

五迷三道 提交于 2019-12-11 00:56:29
问题 I'm trying to load a chrome extension with Watir, and I'm having issues. I found this related question: Ability to launch chrome with extensions loaded with watir-webdriver. However, I am still having the same issue after following that. require 'rubygems' require 'watir-webdriver' require 'ruby-debug' require 'nokogiri' browser = Watir::Browser.new :chrome, :switches => %w[--load-extension=~/.config/google-chrome/Default/Extensions/anepbdekljkmmimmhbniglnnanmmkoja/0.1.12_0] sleep(10) browser

Watir::Exception::MissingWayOfFindingObjectException: invalid attribute: :css

空扰寡人 提交于 2019-12-11 00:34:55
问题 I am pretty sure watir-webdriver had css selector support, but looks like it is not there any more: $ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] $ gem -v 1.8.15 $ gem list selenium-webdriver *** LOCAL GEMS *** selenium-webdriver (2.17.0) $ gem list watir-webdriver *** LOCAL GEMS *** watir-webdriver (0.4.1) $ irb > require "watir-webdriver" => true > browser = Watir::Browser.new :firefox => #<Watir::Browser:0x787eb29124fb7658 url="about:blank" title=""> > browser

Google chrome 29.0 is not working with webdriver

自古美人都是妖i 提交于 2019-12-10 21:52:59
问题 I was trying to load google chrome browser with watir-webdriver, but while invoking any URL in the browser it is throwing following error Selenium::WebDriver::Error::UnknownError: Unknown command 'WaitForAllTabsToStopL oading'. Options: AcceptOrDismissAppModalDialog, ActionOnSSLBlockingPage, Activa teTab, AddBookmark, AddDomEventObserver, AppendTab, ApplyAccelerator, BringBrows erToFront, ClearEventQueue, CloseBrowserWindow, CloseTab, CreateNewAutomationPro vider, DeleteCookie,

Pre-loading browser clipboard for testing pasting into fields with watir-webdriver

被刻印的时光 ゝ 提交于 2019-12-10 18:49:42
问题 Our web application has some event code to "format" any text with pasted into a field so that any HTML styles do not break our data. What would be a good way to pre-load the browser clipboard so that I can test pasting into the input field? Is there any way to do it programmatic-ally or would I have the test script visit "a source page" and copy text before moving onto our application? Any ideas or code snippets would be welcome. 回答1: I would consider using the .value= method to set the value

Watir webdriver Errno::ECONNREFUSED: No connection could be made because the target machine actively refused it. - connect(2)

♀尐吖头ヾ 提交于 2019-12-10 18:26:51
问题 Updated: I'm running the code below to execute my sample test cases: (Windows 7, Watir 3.0.0, Watir-webdriver-0.6.1) require "watir-webdriver" require 'test/unit' class Teste1 $var = Watir::Browser.new :chrome def met1 $var.goto 'google.com' $var.text_field(:name, "q").set 'sample' $var.button(:name =>'btnG').click end end class Teste2 < Test::Unit::TestCase $test = Teste1.new def test_gomet1 $test.met1() end end The browser opens but the script throws the following error: test_gomet1(Teste2)

How to add a proxy with auth to ChromeDriver on Watir

偶尔善良 提交于 2019-12-10 15:18:38
问题 I'm using Watir on Ruby which uses Selenium as its underlying framework. I'm using ChromeDriver, and to set up a proxy I sually did this: b = Watir::Browser.new :chrome, :switches => ["--proxy-server=11.1.1.11:3011"] Sometimes, the proxy comes with user,password authentication like this: 11.1.1.11:3011:3011:user:pass but when I try to put that string into --proxy-server I get an error. How can I configure ChromeDriver to use the authentication? I've tried the format often suggested in other

Watir scraping sequential elements : so simple, but no

倖福魔咒の 提交于 2019-12-10 12:24:30
问题 This is so simple... I want to scrap some web page like that with watir (gem of ruby:) <div class="Time">time1</div> <div class="Locus">locus1</div> <div class="Locus">locus2</div> <div class="Time">time2</div> <div class="Locus">locus3</div> <div class="Time">time3</div> <div class="Locus">locus4</div> <div class="Locus">locus5</div> <div class="Locus">locus6</div> <div class="Time">time4</div> etc.. The result should be an array like that : time1 locus1 time1 locus2 time2 locus3 time3

How to get element with css in PageObject

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-10 11:31:40
问题 In the project on which I add tests, I have some elements complicated to "get". The html of my textarea : <div class="quote"> <div class="clearfix"> <div class="icon"></div> <div class="text"> <span class="yui3-widget yui3-inputwidget yui3-textareawidget yui3-textareawidget-focused" style=""> <span class="yui3-textareawidget-content"> <textarea name="" placeholder=""></textarea> </span> </span> </div> <div class="author"> (...) other text_field </div> </div> </div> </div> For the moment, I