watir-webdriver

How to determine coordinates of an element with Watir Webdriver?

混江龙づ霸主 提交于 2019-12-11 06:53:01
问题 I have a problem. While parsing a page, a pop-up window appears and blocks access to html. I tried to click on the pop-up, but it re-directs me to a new page, and I have no clue how to get to the upper right area of the pop-up to close it. My question is how to determine the coordinates of that element? None of the related issues raised here at Stackoverflow helped me find a solutions, so assistance would be very much appreciated. 回答1: Why do you need the actual coordinates? That seems like a

A better way of iterating and filling data in HTML table using Watir

こ雲淡風輕ζ 提交于 2019-12-11 05:30:38
问题 I have a table which might contain up to 50 rows and has 9 columns. However the code I am using to fill out data in the table its taking so long. Is there a faster way of doing it? Here is my code table = $browser.div(:id => "market").table(:id => 'tableTradeIndMarket') i = 3 + rand(1..table.rows.length-4) table.rows[i].cells[4].select_list.select 'Buy' table.rows[i].cells[5].select_list.select 'Market' table.rows[i].cells[6].text_field.set ($share) table.rows[i+1].cells[4].select_list.select

Locating elements without a specific class name

孤人 提交于 2019-12-11 05:25:53
问题 This is in the same vein as this question I asked before - Watir webdriver; counting elements with changing class names. I was able to add the specific number of elements based on using the class name asset-card selectable . Currently, I am looking to click on more elements to add them to the existing set. Here is my dilemma: When an element is not clicked, the class name is: image-card asset-card selectable When an element is clicked, selected is appended to the class name: image-card asset

In IE9, how can I use watir-webdriver to get past the invalid certificate screen?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 03:10:15
问题 This is the screen with the "There is a problem with this website's security certificate." header. Here is the code for the link I'm trying to click: <tr> <td > </td> <td id="continueToSiteAlign" align="left" valign="middle"> <h4 id="continueToSite"> <img src="red_shield.png" ID="ImgOverride" border="0" alt="Not recommended icon" class="actionIcon"><A href='' ID="overridelink" NAME="overridelink" >Continue to this website (not recommended).</A> </h4> </td> </tr> In IE8 with watir, the code

Watir Help: click-no-wait and execute_script not working as expected

爱⌒轻易说出口 提交于 2019-12-11 02:06:35
问题 Using ruby's Watir gem, I'm trying to click a button that opens a javascript popup, then click 'ok' on the popup and I can't seem to do that. The button is in a frame in a frame. I have searched extensively and read the Watir wiki entry about javascript popups but nothing works. I think this is because execute_script and click_no_wait are not working as expected. For example, the following commands: @browser.execute_script('window.alert = function() {}') @browser.execute_script('alert("hello"

Watir::Exception::MissingWayOfFindingObjectException: invalid attribute: :css

空扰寡人 提交于 2019-12-11 00:34:55
问题 I am pretty sure watir-webdriver had css selector support, but looks like it is not there any more: $ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] $ gem -v 1.8.15 $ gem list selenium-webdriver *** LOCAL GEMS *** selenium-webdriver (2.17.0) $ gem list watir-webdriver *** LOCAL GEMS *** watir-webdriver (0.4.1) $ irb > require "watir-webdriver" => true > browser = Watir::Browser.new :firefox => #<Watir::Browser:0x787eb29124fb7658 url="about:blank" title=""> > browser

Google chrome 29.0 is not working with webdriver

自古美人都是妖i 提交于 2019-12-10 21:52:59
问题 I was trying to load google chrome browser with watir-webdriver, but while invoking any URL in the browser it is throwing following error Selenium::WebDriver::Error::UnknownError: Unknown command 'WaitForAllTabsToStopL oading'. Options: AcceptOrDismissAppModalDialog, ActionOnSSLBlockingPage, Activa teTab, AddBookmark, AddDomEventObserver, AppendTab, ApplyAccelerator, BringBrows erToFront, ClearEventQueue, CloseBrowserWindow, CloseTab, CreateNewAutomationPro vider, DeleteCookie,

Pre-loading browser clipboard for testing pasting into fields with watir-webdriver

被刻印的时光 ゝ 提交于 2019-12-10 18:49:42
问题 Our web application has some event code to "format" any text with pasted into a field so that any HTML styles do not break our data. What would be a good way to pre-load the browser clipboard so that I can test pasting into the input field? Is there any way to do it programmatic-ally or would I have the test script visit "a source page" and copy text before moving onto our application? Any ideas or code snippets would be welcome. 回答1: I would consider using the .value= method to set the value

Watir webdriver Errno::ECONNREFUSED: No connection could be made because the target machine actively refused it. - connect(2)

♀尐吖头ヾ 提交于 2019-12-10 18:26:51
问题 Updated: I'm running the code below to execute my sample test cases: (Windows 7, Watir 3.0.0, Watir-webdriver-0.6.1) require "watir-webdriver" require 'test/unit' class Teste1 $var = Watir::Browser.new :chrome def met1 $var.goto 'google.com' $var.text_field(:name, "q").set 'sample' $var.button(:name =>'btnG').click end end class Teste2 < Test::Unit::TestCase $test = Teste1.new def test_gomet1 $test.met1() end end The browser opens but the script throws the following error: test_gomet1(Teste2)

Selecting local files using watir-webdriver

China☆狼群 提交于 2019-12-10 16:48:50
问题 I'm attempting to automate the process of selecting a local file from a html page using watir-webdriver I have the following html <body> <form method="post" action="upload" enctype="multipart/form-data"> test file to upload: <input type="file" name="file" size="60" id="test"/> <input type="submit" value="Upload" name="upload" id="upload" /> </form> </body> I'm attempting to click the input with an id of test and set a path to the local file I wish to upload using watir-webdriver. I can use