watir

Watir-webdriver - Select a list display style: none

元气小坏坏 提交于 2019-12-04 18:03:45
Hi guys i've been trying to find a solution to my problem everywhere and can't find them. I need to select a value from the second select in this html code, the one that has name="update_status[5955483]" and i don't know how. What i've tried without success. Watir: 1- browser.select_list(:name, "update_status[5955483]").select_value("A") 2 - input_field = browser.div(:class => 'minict_wrapper orange') input_field.link(:name => 'update[5955483}]' ).click 3 - browser.input( :value, "B").click Nothing have worked, the first one's give me error on finding element, the third one just click's on the

How do I scrape data from a page that loads specific data after the main page load?

只谈情不闲聊 提交于 2019-12-04 17:23:35
I have been using Ruby and Nokogiri to pull data from a URL similar to this one from the hollister website: http://www.hollisterco.com/webapp/wcs/stores/servlet/TrackDetail?storeId=10251&catalogId=10201&langId=-1&URL=TrackDetailView&orderNumber=1316358 My script looks like this right now: require 'rubygems' require 'nokogiri' require 'open-uri' page = Nokogiri::HTML(open("http://www.hollisterco.com/webapp/wcs/stores/servlet/TrackDetail?storeId=10251&catalogId=10201&langId=-1&URL=TrackDetailView&orderNumber=1316358")) puts page.css("h3[data-property=GLB_ORDERNUMBERSYMBOL]")[0].text My problem

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

大城市里の小女人 提交于 2019-12-04 15:22:52
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 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').click puts "Time One: #{time1} Time Two: #{time2} Total Time: #{time1+time2}" There is a new Spec being

watir-webdriver cookie jar saving and loading

淺唱寂寞╮ 提交于 2019-12-04 12:55:27
问题 I'm surprised there didn't seem to be much discussion on this. in Mechanize I can easily read an entire cookie jar from the browser, store it to a file, and load it in to a later session/run before loading that website's pages again. How can one do the same with watir-webdriver ? UPDATE Now with 0.5.2 I do see new methods browser.cookies.to_hash which would turn this question into "How to implement .from_hash or similar loader using eg. .clear and .add ?" However I'd be especially keen on

How to send text to a CKEditor WYSIWYG editor box using Watir-WebDriver

社会主义新天地 提交于 2019-12-04 12:06:36
I have a watir-webdriver script that sets a CKEditor box using the code below, but this only works with Firefox on Mac OSX when I focus on the screen. For example, if I focus away and let this script run in the background, the text is not entered (but no exception or error is raised). Anyone know how to always ensure it is set? require "watir-webdriver" b = Watir::Browser.new :firefox b.goto "http://ckeditor.com/demo" b.frame(:title => 'Rich text editor, editor1, press ALT 0 for help.').send_keys "hello world" (Google Chrome works ok on Mac OSX, but I would like to run my tests against Firefox

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

人走茶凉 提交于 2019-12-04 10:34:17
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: C:/Ruby187/lib/ruby/gems/1.8 - RUBY EXECUTABLE: C:/Ruby187/bin/ruby.exe - EXECUTABLE DIRECTORY: C:

Multiple concurrent browser tests with watir-webdriver through different browsers

守給你的承諾、 提交于 2019-12-04 10:16:01
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? You should try WatirGrid . It won't make all the work for you but it will give you a platform to launch

Can we using regular expression in xpath value?

好久不见. 提交于 2019-12-04 07:47:22
Can we using regular expression in xpath value? I am using xpath value to identify an element on web for automation. I have following :xpath value. :xpath,'//*[@id="ngdialog4"]/div[2]/div[2]/table/tbody/tr/td[1]/input' But, the last digit 4 ngdialog4 is not constant and it keeps on changing each time i open pop-up... can i use some regular expression to match any digit? alecxe You could have theoretically used matches() , but it is a part of xpath 2.0 , which webdriver doesn't support, see a detailed explanation here: Is string matches() supported in Selenium Webdriver 2? Apply a starts-with()

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

会有一股神秘感。 提交于 2019-12-04 07:28:14
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 caching response and display them accordingly). I considered changing all the display:none in the page or

RUBY/WATIR/RASTA: Pass the value from the excel/rasta to an array in Ruby?

孤者浪人 提交于 2019-12-04 06:50:28
问题 How to pass the value separated with comma from the excel/rasta to an array in Ruby. html looks like this, .... <li><input type="checkbox" name="order:1" />Burger</li> <li><input type="checkbox" name="order:2" />Pasta</li> <li><input type="checkbox" name="order:3" />Fries</li> ... EXCEL looks like this... Orders Burger, Pasta this code doesnt work attr_accessor :orders order = [@orders] order.each do |i| ....... ........ It should look like this in ruby... attr_accessor :orders orders = [