watir

Ruby with Watir: Handling javascript popup window

与世无争的帅哥 提交于 2019-12-20 05:58:11
问题 I have a problem with watir and javascript popup window here's my test script require 'watir' browser = Watir::Browser.start "/url/" browser.link(:text, /Add New Blog/).wait_until_present browser.link(:text, /Add New Blog/).click // Here is where the javascript window popup window = browser.ie.Document.ParentWindow browser.window(:title, /Blog/) do browser.text_field(:id, /text title of Blog/).set 'Watir' browser.select_list(:id, /dropdownlist type/).select ("News") browser.button(:value,

watir-webdriver - clicking Javascript button

蓝咒 提交于 2019-12-20 03:27:36
问题 First week with watir-webdriver and Web app testing in general, so still trying to wrap some concepts around. Having this javascript element: <input type="submit" class="button" value="Search" name="_target0"> browser.button(:value, "Search").exists? => "true" browser.button(:value, "Pesquisar").present? => true browser.button(:name, "_target0").value => "Search" This doesn't actually drive the button to get clicked, browser.button(:name, "_target0").click So I got the driven Firefox clicking

How to disable download window in firefox with watir-webdriver?

爱⌒轻易说出口 提交于 2019-12-20 03:19:28
问题 I don't want to handle download window in Firefox or IE. I want to auto download the excel file without any download window. I have tried to set several configuration parameters for Firefox, but it didn't work. In my test I'm trying to download excel file profile = Selenium::WebDriver::Firefox::Profile.new profile['browser.download.lastDir'] = 'C:\\Downloads' profile['browser.download.folderList'] = 2 profile['browser.download.dir'] = 'C:\\Downloads' profile['download.prompt_for_download'] =

Timeout::Error in Rails application using Watir

我是研究僧i 提交于 2019-12-20 02:29:26
问题 I am using Watir to browse pages and take screenshots of some pages in my application. However, getting a page from my server takes a while, and I get Timeout::Error. To fix this, I used a wait in my Watir browser instance, to check to see if a div with id 'content' exists, and to make it wait until it exists. However, it takes some time, and the page is loaded in the Watir browser. But after it is loaded, I get the Timeout::Error in my main browser window. Here's my code: @pages = Pages.all

LoadError: cannot load such file — selenium/webdriver/phantomjs

狂风中的少年 提交于 2019-12-19 08:59:41
问题 I have this code in my Cucumber Hooks file to run the ghost driver it was working until yesterday I start seeing the error message: Before do Selenium::WebDriver::PhantomJS.path = 'C:\phantomjs-2.1.1-windows\bin\phantomjs.exe' @browser = Watir::Browser.start "https://www.google.com", :phantomjs @browser.window.maximize end Error message: LoadError: cannot load such file -- selenium/webdriver/phantomjs 回答1: Yes, we've removed support for PhantomJS as of Selenium 3.8. The PhantomJS project is

Dismiss “Confirm Navigation” popup with Watir

无人久伴 提交于 2019-12-19 06:24:10
问题 I am trying to dismiss "Confirm Navigation" popup. This is how it looks like in Chrome. To see the popup: require "watir-webdriver" browser = Watir::Browser.new browser.goto "http://www.gravityforms.com/demo/wp-admin/admin.php?page=gf_new_form" browser.text_field(:id => "user_login").set "demo" browser.text_field(:id => "user_pass").set "demo" browser.button(:id => "wp-submit").click browser.refresh At the moment I override onbeforeunload when I visit the page, as suggested at http:/

Can I use Watir to scrape data from a website on a linux server without monitor?

随声附和 提交于 2019-12-18 13:37:35
问题 Can I use Watir to scrape data from a website (AJAX used) but on a linux server without monitor? (linode.com) ? 回答1: There are several ways to do this: Use HtmlUnit, either Celerity or watir-webdriver (through the remote Selenium2/WebDriver server). Use a real browser + a virtual X server (Xvfb). I'd recommend using watir-webdriver's Firefox driver and the Headless gem for a simple way to control this from Ruby. This is basically a tradeoff between speed and realism. Personally I'd go with #2

Can you deploy Watir on Heroku to generate HTML Snapshots? If so, how?

故事扮演 提交于 2019-12-18 12:42:53
问题 I would like to generate HTML Snapshots using Watir, hosted on Heroku. Google's Full Specification for Making AJAX Applications Crawlable suggests using HTMLUnit... see How do I create an HTML snapshot? point #3. HtmlUnit is a Java-only headless browser emulator; and unfortunately jRuby is not an option on Heroku. So HtmlUnit is ruled out (to my knowledge). If you're interested I have another question open regarding HtmlUnit as a service hosted on Google App Engine... Making AJAX Applications

Cannot click html element with watir

自古美人都是妖i 提交于 2019-12-18 09:52:40
问题 I want to click the "button" below, but cannot click it. The html is: <table onclick="filtersJob_intrinsic_extender.addRow();return false;" class="FilterList_addLink"> <tbody> <tr> <td class="icon"><img src="/commander/lib/images/icn12px_add.gif" alt="Add Filter"></td> <td class="text">Add Intrinsic Filter</td> </tr> </tbody> </table> I am basically doing this with watir and watir-webdriver: browser.td(:text => 'Add Intrinsic Filter').click I tried this method on another similar button in

Is there a way to slow down execution of Watir Webdriver under Cucumber?

坚强是说给别人听的谎言 提交于 2019-12-18 09:45:41
问题 Is there any way we can slow down the execution of Watir WebDriver under Cucumber? I would like to visually track the actions performed by Watir. At the moment, it goes too fast for my eyes. 回答1: While Watir itself does not have an API for slowing down the execution, you could use the underlying Selenium-WebDriver's AbstractEventListener to add pauses before/after certain types of actions. Given you want to see the result of actions, you probably want to pause after changing values and