watir

Selenium WebDriver Change Firefox path to Tor

折月煮酒 提交于 2019-12-10 11:27:03
问题 I'm trying to change webdriver in ruby to open a tor browser instead of the default firefox broswer. I'm using the following code and I have a tor browser open before I run this code. path='C:\Users\Bonnnie\Downloads\Tor Browser\App\tor.exe' Selenium::WebDriver::Firefox.path = path driver = Selenium::WebDriver.for :firefox I get the following error: unable to obtain stable firefox connection in 60 seconds I think I might be linking to the wrong tor file. 回答1: The following worked for me with

How to open tor browser using watir?

依然范特西╮ 提交于 2019-12-10 10:49:23
问题 With my ruby code I want to open Tor Browser instead of Firefox,for this I tried this code path='C:\Tor Browser\App\tor.exe' Selenium::WebDriver::Firefox.path = path driver = Selenium::WebDriver.for :firefox ie = Watir::Browser.new :firefox, :driver => driver I got this error c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.35.1/lib/selenium/webdriver/firefox/launcher.rb:79:in `connect_until_stable': unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (Selenium:

How to detect if an element exists in Watir

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 02:46:59
问题 I'm relatively new to Watir but can find no good documentation (examples) regarding how to check if an element exists. There are the API specs, of course, but these make precious little sense to me if I don't find an example. I've tried both combinations but nothing seems to work... if browser.image (:src "/media/images/icons/reviewertools/editreview.jpg").exists then... if browser.image (:src "/media/images/icons/reviewertools/editreview.jpg").exists? then... If anyone has a concrete

Watir and text field inside iframe

回眸只為那壹抹淺笑 提交于 2019-12-09 03:43:33
问题 I'm trying to setup new text into a text field using Watir. The text field is placed inside iframe. <div id="div_popup_layer" style="width: 100%; height: 100%;"> <div id="id_Login" class="ui-draggable" style="position:absolute;left:372.5px;top:279px;width:501px;height:274px;z-index:15"> <table id="popup_cont_id_Login" cellspacing="0" cellpadding="0" topmargine="0"> <tbody> <tr> <td align="left" valign="middle"> <iframe id="frame_id_Login" height="274px" frameborder="0" width="501px"

Selenium or Watir Webdriver, how to save resized screenshot?

半城伤御伤魂 提交于 2019-12-08 19:34:30
I try to get a resized 400x400 screenshot of google. I try this both in Selenium and Watir with no success. require 'watir-webdriver' b = Watir::Browser.new b.goto 'google.com' b.window.resize_to(400,400) b.driver.save_screenshot("screenshot.jpg") I always get the screenshot with the original browser size. Any idea how can I save it resized to 400x400? At present, WebDriver defines a screenshot as a "full page screenshot". That is, the entire DOM should be represented by the image generated by the save_screenshot method. The fact that the Chrome driver doesn't generate a screenshot of the full

Using Watir to click on a specific link when there are other links with the same display text

蹲街弑〆低调 提交于 2019-12-08 12:56:03
问题 so i have a table that looks something like that where there is a list of books and in the very first column there is two links, view and delete, for each book. i would like to be able to use Watir to find the row with a specified book title and click on that view button for that book. Here is what I have so far And /^click on View link of "(.*)" on the result set table$/ do |cell_name| cellButton("submit.view", cell_name, "") end # # And /^click on Delete link of "(.*)" on the result set

How to handle new browser pop up after clicking a js button in Watir?

狂风中的少年 提交于 2019-12-08 12:20:32
问题 I am trying to using watir in ruby, I am able open a browser, enter some values to a username/password form, but then I press enter, then I click the submit button (actually it is pressing an enter, it is easiler to code), it would pop up a new browser windows for our application, then I found I have no control to the new browser. What can I do? In addition to my problem, the new browser window got no menubar, no toolbar, no navigation bar, thus I cannot open the IE developer toolbar to find

Is “enabled?” method available on Watir and/or Page-Objects for a link?

独自空忆成欢 提交于 2019-12-08 11:42:43
问题 Yesterday i was working on determining is this link was or not enabled, waiting until enabled in order to click it. I'm using Cucumber + Ruby + Watir + Page-Object gem. The link is very similar to: <a id="the_link" href="#" disabled="disabled">Proceed with your order</a> Once you fill some fields, the link is enabled and the source changes to: <a id="the_link" href="#">Proceed with your order</a> The idea is to wait until the link is enabled in this way, which works with buttons: def click_on

How to add and execute html2canvas on a webpage with Watir

风流意气都作罢 提交于 2019-12-08 04:18:37
问题 How can I add a html2canvas to a given webpage, execute it, and then read its results with Watir? require 'watir' b = Watir::Browser.new :firefox b.goto "google.com" path = "/path/to/html2canvas.js" # v. 0.5.0-alpha1 h2c_payload = File.read(path) b.execute_script h2c_payload h2c_activator = %< function genScreenshot () { var canvasImgContentDecoded; html2canvas(document.body, { onrendered: function (canvas) { window.canvasImgContentDecoded = canvas.toDataURL("image/png"); }}); };

Selenium or Watir Webdriver, how to save resized screenshot?

柔情痞子 提交于 2019-12-08 03:48:15
问题 I try to get a resized 400x400 screenshot of google. I try this both in Selenium and Watir with no success. require 'watir-webdriver' b = Watir::Browser.new b.goto 'google.com' b.window.resize_to(400,400) b.driver.save_screenshot("screenshot.jpg") I always get the screenshot with the original browser size. Any idea how can I save it resized to 400x400? 回答1: At present, WebDriver defines a screenshot as a "full page screenshot". That is, the entire DOM should be represented by the image