watir

How can I get value of element custom attribute with Watir

女生的网名这么多〃 提交于 2019-11-30 19:14:59
I have HTML that looks like this: <input custom_attribute="so cool" type="text" /> I would like to get value of custom_attribute using Watir . browser.text_field(:index, 1).attribute_value("custom_attribute") #=> "so cool" Sources: http://www.mail-archive.com/wtr-general%40rubyforge.org/msg06769.html http://rdoc.info/gems/watir/1.6.6/Watir/Element#attribute_value-instance_method https://github.com/watir/watir-classic/blob/master/lib/watir-classic/element.rb http://zeljkofilipin.com/watir-select-element-using-custom-attribute/ 来源: https://stackoverflow.com/questions/1443455/how-can-i-get-value

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

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

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

亡梦爱人 提交于 2019-11-30 10:19:27
Can I use Watir to scrape data from a website (AJAX used) but on a linux server without monitor? (linode.com) ? 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 if the site has any complex JavaScript or invalid HTML, but both approaches could be worth investigation

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

心不动则不痛 提交于 2019-11-30 07:46:51
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 Crawlable? How to build a simple web service on Google App Engine to produce HTML Snapshots? ...

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

How can I get value of element custom attribute with Watir

萝らか妹 提交于 2019-11-30 02:41:51
问题 I have HTML that looks like this: <input custom_attribute="so cool" type="text" /> I would like to get value of custom_attribute using Watir. 回答1: browser.text_field(:index, 1).attribute_value("custom_attribute") #=> "so cool" Sources: http://www.mail-archive.com/wtr-general%40rubyforge.org/msg06769.html http://rdoc.info/gems/watir/1.6.6/Watir/Element#attribute_value-instance_method https://github.com/watir/watir-classic/blob/master/lib/watir-classic/element.rb http://zeljkofilipin.com/watir

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