watir

Checking values with Cucumber and Watir

怎甘沉沦 提交于 2019-12-25 08:56:58
问题 I've been trying to get started with Cucumber and Watir. I've done the installation and written/copied a simple 'feature'. However, I'm not getting anywhere with checking what's on a page. This my feature: Feature: Search Google In order to make sure people can find my documentation I want to check it is listed on the first page in Google Scenario: Searching for JS.Class docs Given I have opened "http://www.google.com/" When I search for "JS.Class" Then I should see a link to "http://jsclass

selecting elements using variables in ruby /watir

你离开我真会死。 提交于 2019-12-25 08:03:22
问题 The real issue I am encountering is the delay on population of drop down lists in a web page. The call i am using in the script is :- clickOndropDown(":id","dropDownAutocomplete","ABC",@b) where 1. clickOndropDown is the method invoked 2. id is the element selector (which can be :id,xpath, or :css [which are different selectors in my html code for different dropdown boxes] to handle all cases within the code) 3. ABC is the element to be selected from the drop down list 4. @b is the browser

Watir+Cucumber Connection refused

巧了我就是萌 提交于 2019-12-25 06:48:15
问题 Folks, I am using watir+cucumber in my tests and for each feature I am reusing the instance of the browser, that is I create the instance of @@browser = Watir::Browser.new and then reuse this through out my tests, I am using watir-webdriver , my tests where running fine till now, I just added another scenario and I consistently get the below error message: Connection refused - connect(2) (Errno::ECONNREFUSED) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb

page-object gem seems not working

泪湿孤枕 提交于 2019-12-25 04:53:15
问题 I am trying to use page-object gem in my watir-webdriver scripts and I think I might be missing something. Here is my code for log_in.rb: require "./all_deals" class LogIn include PageObject text_field(:email, :id => 'UserName') text_field(:password, :id => 'Password') checkbox(:remember_me, :id => 'RememberMe') button(:log_me_in, :value => 'Login') def initialize(browser) @browser = browser end def log_in (email, password) self.email = email self.password = password remember_me log_me_in

Unable to find method for detecting if element exists on a page

試著忘記壹切 提交于 2019-12-25 03:15:51
问题 I'm very new to Watir. I have a bit of Ruby/Watir code that is supposed to detect if an element, exists, and if so, click it, if not, click a different element. Both elements, show up, every time. Unfortunately nothing I've tried works. if browser.contains_text("/media/images/icons/reviewertools/editreview.jpg") then browser.image(:src => "/media/images/icons/reviewertools/editreview.jpg").click else browser.image(:src => "/media/images/icons/reviewertools/savereview.jpg").click end This

continued example - cannot find watir element

坚强是说给别人听的谎言 提交于 2019-12-25 02:57:14
问题 In Cannot click html element with watir, i was trying to click an element which gives me the row below: I am not able to find the three dropdown lists which you see in the image above. How do I do it ? Each time, the id of the dropdown elements changes. For example, the middle one html code is: <td> <select id="filtersJob6_intrinsic_enumOperator" name="filtersJob6_intrinsic_enumOperator" onchange="if(top.document.getElementById('filtersJob6_intrinsic_enumOperator').value=='isNull'||top

Filling out form with Selenium works on Chrome but not Firefox

牧云@^-^@ 提交于 2019-12-24 21:45:07
问题 I'm trying to fill out a textarea using Selenium and ruby in Firefox, but for some reason, the code below doesn't work. When I switch the same script to Chrome driver though, it does work. browser.textarea(:placeholder => "Add a comment…").set "#{randomly_chosen_comment}" On firefox, I get this error: /Users/miajohansson/.rvm/gems/ruby-2.2.4/gems/watir-6.10.3/lib/watir/elements/element.rb:623:in `raise_present': element located, but timed out after 30 seconds, waiting for #<Watir::TextArea:

Selenium / Watir TCP connection fails only on worker dyno heroku

前提是你 提交于 2019-12-24 20:54:46
问题 Why would watir only fail on a heroku worker node? I'm trying to go to run a basic function of going to google.com. This works fine when I run it on a web dyno but fails when I use delayed job to run it on a worker. The code is as follows Selenium::WebDriver::Chrome.path = "/app/.apt/usr/bin/google-chrome" Selenium::WebDriver::Chrome.driver_path = "/app/vendor/bundle/bin/chromedriver" browser = Watir::Browser.new :chrome browser.goto "google.com" I then receive the following error: Failed to

Cheezy Dynamic Finder for Page Section

冷暖自知 提交于 2019-12-24 20:15:50
问题 I'm on ruby using the page-object-gem by cheezy. Following the excellent answer here, I decided to ask this question (a page_section isn't an element I think). Anyway what is the syntax for the dynamic finder/locator for a page_section and page_sections ? 回答1: I do not believe this scenario was considered in the original design, so there is not great support. Feel free to request it at https://github.com/cheezy/page-object/issues . That said, you could use the internal platform object's #page

Suppress auto-closing window in Watir

偶尔善良 提交于 2019-12-24 14:40:22
问题 I am using Watir with Chromedriver to automate form submission on some website. I have to login and submit multiple forms. The problem is, when I click the submit button the page the page automatically closes, so when I goto('next_url') I get this error: /Users/jackz/.rvm/gems/ruby-1.9.3-p327/gems/selenium-webdriver-2.27.2/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok': 'auto_id' does not refer to an open tab (Selenium::WebDriver::Error::UnknownError) The Watir instance is still