watir-webdriver

Is it possible to globally increase Watir-Webdriver when_present wait time?

蹲街弑〆低调 提交于 2019-12-19 18:56:17
问题 I am writing an automated testing program which will test some web programs that are sometimes slow to load certain AJAX calls. For instance the user will click 'Query' which will result in a HTML 'loading' overlay for anywhere from 15 to 90 seconds. When the search completes, it will then update a table on the same page with the results. So obviously I can increase the waiting time individually like so: browser.td(:id => 'someId').when_present.some_action #=> will wait 30 seconds browser.td(

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:/

Running Selenium::WebDriver::Firefox inside Xvfb from ruby as NON-root user

佐手、 提交于 2019-12-19 02:47:35
问题 I'm trying to do some headless testing using a ruby script. Essentially I'm executing Xvfb on display :1, and then firing up Watir::Browser.new(:firefox) using watir-webdriver. This works great if you run the script as root - I can run x11vnc and watch the script execute the browser and interact with it. The problem is, I need to be able to call this ruby script from a Rails app, and NOT run it as root... if I try to run the script from the command line as a regular user, Xvfb fires up on :1

How do I locate a custom tag like <g>?

守給你的承諾、 提交于 2019-12-18 17:03:59
问题 I'm having to deal with some graphic items in a page that have <g> tags. I can do something like this to find them by dropping into selenium webdriver: browser.wd.find_elements( :tag_name => "g" ) What would be the equivalent for watir webdriver? Also, how would I convert those selenium elements into watir elements? Could I add support for a <g> tag to watir locally somehow? 回答1: Solution 1 - Watir-Webdriver Equivalent: The equivalent to what you were doing in selenium-webdriver is: browser

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

Watir webdriver: Doesn't do anything after opening browser (firefox)

删除回忆录丶 提交于 2019-12-18 09:38:52
问题 It was working fine before, now whenever I run the script it just opens Firefox then does nothing. It works when running with chromedriver though. Tried updating gems etc, but no success. 回答1: The latest Firefox version will no longer work with the legacy Firefox Driver. To use Watir with Firefox 48+ you need to download geckodriver and follow the instructions for Ruby. Since Geckodriver is not yet feature complete, you most likely will want to continue using the legacy Firefox Driver, which

Handling a javascript popup occurring on a keyup event

不问归期 提交于 2019-12-17 20:10:57
问题 I have a text-field on a HTML page which checks whether you have entered a value between 1 to 365. If the user enters an invalid value like a non-numeric character or a value which does not fall inside the range, it shows a popup. I saw on the watir wiki that there is a select_no_wait method which is used to dismiss popups when you select an invalid value from the list. What is a good way to handle a popup occurring on a keyup event? Do i need to proceed along the lines the way select_no_wait

Accessing an element with no attributes in Watir

痴心易碎 提交于 2019-12-17 18:59:22
问题 Using Watir, is there a way to access an element without attributes? For example: <span>Text</span> I'd like to avoid using xpath, but if that's the only way it's cool. 回答1: Disregarding the non-WATIR issues of having tags in the first place, or requesting unique attributes from your developers (or yourself), you can always access an element via its parent elements, or by index. For example: Text @browser.div(:name => "content").span(:index => 1) #this is the first span element inside this

Truly headless web browser (with non-headless abilites)?

好久不见. 提交于 2019-12-14 04:00:22
问题 The challenge I'm tasked with is to run headless (most of the time) but have the ability to launch the current state of the headless browser in the default browser on the machine. By headless I mean no open browser windows. So I'm running PhantomJS in conjunction with waitr-webdriver. In the headless state I am completing a multi-page form. At the end of the form I need to be able to launch that page/session with current state in my native browser. How can this be accomplished? Imagine this