watir-webdriver

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

旧街凉风 提交于 2019-11-30 20:24:15
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 as usual, but Watir won't start a browser... it eventually times out after 60 seconds. Connecting via

Is drag-and-drop possible in watir-webdriver?

戏子无情 提交于 2019-11-30 17:29:10
I would like to drag-and-drop one element to the position of another, triggered from within a watir-webdriver script. By "drag-and-drop" I mean picking up a draggable element and releasing it on another. By "possible" I mean any method for drag/drop that can be executed from a watir-webdriver script. This includes code snippets, third party gems, etc. As I understand it drag-and-drop is a feature request for core watir-webdriver (at time of asking), so I'm looking (in principle) for an alternative. UPDATE drag-and-drop is now part of core watir-webdriver (as of 0.5.0, I believe) UPDATE 2 For

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

时光总嘲笑我的痴心妄想 提交于 2019-11-30 15:35:50
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? Solution 1 - Watir-Webdriver Equivalent: The equivalent to what you were doing in selenium-webdriver is: browser.elements( :tag_name => "g" ) So you can do something like this to output the text of each element: browser

Watir. Scroll to a certain point of the page

混江龙づ霸主 提交于 2019-11-30 13:24:24
问题 I am trying to automate an online survey on a website but I get this error each time: Selenium::WebDriver::Error::UnknownError: unknown error: Element is not clickable at point (561, 864). Other element would receive the click: a id="habla_oplink_a" class="habla_oplink_a_normal hbl_pal_header_font_size hbl_pal_title_fg " What I need to understand is how I can scroll to a certain point of the page so that my script can resume filling out the survey on the page. This is my code that manages to

Stop loading page watir-webdriver

徘徊边缘 提交于 2019-11-30 07:41:02
问题 Is there a way to stop loading a page with watir-webdriver on firefox? Or is there a way to force something in my script even if the page is still loading? At a point in my script, the website will hang and the script eventually timeouts. 回答1: You can use the Timeout class to force it to give up after waiting a reasonable amount of time (and this is internally how Watir performs it's waits as well) begin Timeout::timeout(10) do # perform actions that may hang here end rescue Timeout::Error =>

Watir. Scroll to a certain point of the page

最后都变了- 提交于 2019-11-30 07:23:31
I am trying to automate an online survey on a website but I get this error each time: Selenium::WebDriver::Error::UnknownError: unknown error: Element is not clickable at point (561, 864). Other element would receive the click: a id="habla_oplink_a" class="habla_oplink_a_normal hbl_pal_header_font_size hbl_pal_title_fg " What I need to understand is how I can scroll to a certain point of the page so that my script can resume filling out the survey on the page. This is my code that manages to fill out a portion of the survey but fails when it reaches a row which is not in view inside the

Is drag-and-drop possible in watir-webdriver?

寵の児 提交于 2019-11-30 01:50:04
问题 I would like to drag-and-drop one element to the position of another, triggered from within a watir-webdriver script. By "drag-and-drop" I mean picking up a draggable element and releasing it on another. By "possible" I mean any method for drag/drop that can be executed from a watir-webdriver script. This includes code snippets, third party gems, etc. As I understand it drag-and-drop is a feature request for core watir-webdriver (at time of asking), so I'm looking (in principle) for an

How to run Chrome/Firefox with disabled flash plugin from watir script?

≡放荡痞女 提交于 2019-11-29 22:46:09
问题 How to run Chrome/Firefox with disabled flash plugin from watir script? If I disable flash in Chrome, next time when I execute watir-webdriver script Flash is enabled again. 回答1: For Firefox it is easy. Disable flash in your default profile (the one you normally use) and then start the browser like this: browser = Watir::Browser.new :firefox, :profile => "default" More information: http://watirwebdriver.com/firefox/ For Chrome I thought this would do it, but looks like I am doing something

Cannot click html element with watir

孤街浪徒 提交于 2019-11-29 18:13:05
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 another website and it worked. I wonder why it does not work here. It causes the exception: Selenium:

Stylesheets not applied in Chrome

£可爱£侵袭症+ 提交于 2019-11-29 17:34:11
Using Watir with Chromedriver. When running tests (not headless), my stylesheets are not applied. When running chrome normally (not testing) my stylesheets show up. What's the deal? This didn't happen yesterday. Specs: Ubuntu 16.04 LTS Chrome Version 59.0.3071.104 (Official Build) (64-bit) ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) watir 6.2.1 ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] I assume that you are accessing the application-under-test via embedded credentials. Chrome v59 removes support for embedded credentials in subresource requests. Here's what the