watir

How to get element with css in PageObject

被刻印的时光 ゝ 提交于 2019-12-06 08:19:47
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 use this line to set value @browser.element(:css => ".quote textarea").send_keys "test" In PageObject, I

I want to calculate the page load time in Watir or Selenium

守給你的承諾、 提交于 2019-12-06 07:55:05
问题 Here is the scenario: 1. Login to a web application with username and password and hit Enter (Start timer) 2. Load the login page (lap timer split, to mark the time for page load ) 3. Click on a another page (split the lap timer) 4. Stop the stop watch 回答1: Any method call in Watir returns how long it takes, so this is a trivial task. For example, b.text_field(:id, 'uid').set username b.text_field(:id, 'pwd').set password time1 = b.button(:id, 'logon').click time2 = b.button(:id, 'movepage')

Is there a way to determine if an element is clickable in Chrome Browser using Selenium and Watir?

跟風遠走 提交于 2019-12-06 07:22:34
As I understand it, this question is really only relevant when performing web test automation using Chrome browser due to the manner in which a click event is implemented with Selenium Webdriver and Chromedriver. To preface, I use and am aware of finding an element through the use of the Watir element function "present?", which as I understand is essentially a combination of "visible?" and "exists?". I could also, at need find an element with Webdriver element functions to identify if an element is present with a rescue for an exception if it is not. What I am trying to determine is the

“Watir::Exception::NoMatchingWindowFoundException: browser window was closed” error when using IE 11 x64 with Page-Object

China☆狼群 提交于 2019-12-06 06:37:02
I'm running tests in Ruby Mine 2.7.1 using Page-Object + Rspec. Environment: Windows 7 x64, Ruby 1.9.3 p551, IE 11. Gems: watir , rspec , bundler , page-object When i run tests in Chrome or Firefox everything is ok. But when i try to run them in IE, the IE window with correct page gets opened and after that i get an error specified in Subject: "Watir::Exception::NoMatchingWindowFoundException: browser window was closed" The point is that the browser is actually open at that moment and shows a correct page. (See the screencast showing what happens: http://screencast.com/t/06prRy3OMLM ) Test

Watir question regarding select_list and reloading

一世执手 提交于 2019-12-06 06:35:48
I have a drop down with multiple options. Whenever you choose an option, the page reloads with data specific with that option. Currently I'm using select.list(:name, strg).set(value) and it does that part just fine, but it does not reload the page with the specific data. Anyone know how to help. When i watch it in action, it doesn't select the option either, but my logs show that it does.Thanks. Edit: Got it to work with fire_event("onclick") Without seeing the page, my guess is that you have to fire JavaScript event. Something like: select.list(:name, strg).set(value) select.list(:name, strg)

Multiple concurrent browser tests with watir-webdriver through different browsers

南楼画角 提交于 2019-12-06 05:46:37
问题 so I'm working on a website here and I would like to run multiple browser tests at one time. What I mean by this is it should perform my smoke tests on ie, firefox and chrome at the same time and report back each browser results. I'm currently only testing with ie with rpsec and watir-webdriver but would like to automate for the other 2 browsers. Are there any existing gems out there (I haven't been able to find any), if not what would be the best way to go around solving this issue? 回答1: You

`marshal data too short` error message while installing watir-webdriver on Windows XP

自作多情 提交于 2019-12-06 05:45:22
问题 I have a clean installation of Windows XP (Professional, Version 2002, Service Pack 3) in VMware Fusion virtual machine (3.1.2 332101). (Host machine is MacBook Pro, Mac OS 10.6.7.) XP installation has 512 MB RAM and is fully updated, except I left Internet Explorer at version 6. I have installed Ruby and RubyGems: C:\Documents and Settings\zeljko>gem env RubyGems Environment: - RUBYGEMS VERSION: 1.6.2 - RUBY VERSION: 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32] - INSTALLATION DIRECTORY:

why must I sleep or wait using watir-webdriver and firefox?

落爺英雄遲暮 提交于 2019-12-06 04:47:25
问题 Well i wanted to comment on watir-webdriver wait for page load>this topic but since i have 1 rep I cannot. I'm upgrading my watir scripts to watir-webdriver and the first test i ran on Firefox yielded: Selenium::WebDriver::Error::NoSuchElementError: Unable to locate element: {"method":"tag name","selector":"body"} when all I was doing was logging into my app (which worked fine), clicking the Build Info link, and doing a: @browser.text This happened consistently. After reading on here, I put a

How do I read text from non visible elements with Watir (Ruby)?

半世苍凉 提交于 2019-12-06 04:16:17
问题 There is a div on a page that is not visible but has some value I want to capture. Calling text on it returns me an empty string. How do I get the value displayed without having to deal with the raw html? Can I force .text to return me the actual value regardless of the visiblity of the text in the browser? irb(main):1341:0> d.first.visible? => false irb(main):1344:0> d.first.html => "<div class=\"day\">7</div>" irb(main):1345:0> d.first.text => "" PS: There are many many divs (the page is

How to access a new browser tab

好久不见. 提交于 2019-12-06 02:51:37
Watir noob here. I'm attempting to connect to and manipulate a newly spawned browser tab, but am a little confused about how to recognize the new tab. Here's what I have: Windows 7 (32 bit) IE 10 Ruby 1.9.3-p392/TDM-32.4.5.2 LOCAL GEMS watir (4.0.2 x86-mingw32) watir-classic (3.6.0) watir-webdriver (0.6.3) Basic gist of the Script: require 'rubygems' require 'Watir' ie=Watir::Browser.new ... First part of the script on the original browser tab is completed. The original browser tab generates a second browser tab, which I need to access. I've read a response somewhere that I need to link to the