watir-webdriver

Turning a select_list options into a string array in watir-webdriver?

冷暖自知 提交于 2020-01-12 10:45:31
问题 I need to check the contents of a select list drop down which varies depending on a value in another field. I am reading the valid options into an array of strings from a CVS field and comparing by doing the following; selectContent = [] $browser.select_list(:id,"srch-status-select").options.each {|option| selectContent << option.text} assert_equal(validContent,selectContent,"Status drop down has wrong values") Is this correct or is there an existing select_list method which does a similar

Setting a text field that has a JQuery mask on it

久未见 提交于 2020-01-11 14:10:23
问题 Using watir-webdriver, I am trying to set the value for a text field. browser.text_field(:id, "phoneNumbers_value_input").set("5555551234") When I run that command, I can see that watir found the field because the cursor is set on that field however no text is entered. I have also tried the send_keys and append commands but nothing seemed to work. No exception is thrown from these methods. The only difference I could find between this field and the other fields on the page(which all work fine

Can't connect to Tor-Firefox via Watir

拜拜、爱过 提交于 2020-01-11 09:30:10
问题 I am having issues connecting to Tor via Ruby - Watir webdriver. I use the Tor Browser Bundle. The problem is that when I try to connect via Watir (Selenium) I cannot seem to open Tor instead of regular Firefox. Looking at similar issues I've tried the following: require 'watir-webdriver' profile = Selenium::WebDriver::Firefox::Profile.new profile['network.proxy.socks'] = '127.0.0.1' #the proxy tor uses profile['network.proxy.socks_port'] = 9150 #I cannot use 9050, 9150 works when I use Tor

Firefox 4 with watir webdriver: Need help using helperApps.neverAsk to save CSV without prompting

邮差的信 提交于 2020-01-11 03:18:46
问题 I learned how to use Firefox 4 with watir and webdriver (on Win7 x64), setting profile items. Example: profile = Selenium::WebDriver::Firefox::Profile.new profile["browser.download.useDownloadDir"] = true profile["browser.download.dir"] = 'D:\\FirefoxDownloads' profile["browser.helperApps.neverAsk.saveToDisk"] = "application/csv" driver = Selenium::WebDriver.for :firefox, :profile => profile browser = Watir::Browser.new(driver) What I try to do with the example below, is setting CSV files to

How do I change the page load Timeouts in Watir-Webdriver (timeout in .click method)

て烟熏妆下的殇ゞ 提交于 2020-01-09 12:51:40
问题 I have the following code browser.link(:text => 'Generate Report').click browser.radio(:value => 'byTotalValue').wait_until_present(180) which requests that a report be generated and then waits for the report by looking for an element on the report page. The report can take upwards of 2 minutes to appear. What is happening is a Timeout::Error is being raised from the click method after 60 seconds. I suspect that Watir-Webdriver has implemented some form of wait for page load within the click

Accessing a div element in an array of li elements

孤街醉人 提交于 2020-01-07 08:26:16
问题 I am trying to access a div in an li array <ul> <li class="views-row views-row-1 views-row-odd views-row-first"> <div class="news-item"> </li> <li class="views-row views-row-2 views-row-even"> <li class="views-row views-row-3 views-row-odd"> <div class="news-item"> <div class="image"> <div class="details with-image"> <h2> <p class="standfirst">The best two-seat </p> <div class="meta"> <div class="pub-date">26 April 2012</div> <div class="topic-bar clearfix"> <div class="topic car_review"

Watir webdriver; counting elements with changing class names

早过忘川 提交于 2020-01-07 02:11:11
问题 I am using Rspec and Watir-webdriver and am looking to get a count of all the elements that have been clicked. What I'm doing: I perform a search and get back a list of results; I then run a loop to select only 5 of them. The class name for these elements goes from asset-card selectable to now saying asset-card selectable selected . I try to get a proper count by doing this: count = @browser.elements(:class, 'selected').size But this is still giving me all results and not specifically the

How to control test execution speed in watir-webdriver with the Watir::Browser#speed= method? [duplicate]

戏子无情 提交于 2020-01-06 21:58:46
问题 This question already has answers here : Is there a way to slow down execution of Watir Webdriver under Cucumber? (2 answers) Closed 4 years ago . Is there any way to control test execution speed in watir? How can I slow down the speed of test execution? Someone suggested me to use following method browser.speed = :slow but, there is no such method for the Watir::Browser class with the browser driver I'm currently using. 回答1: Speed Defaults to Slow According to the documentation, Watir:

Accessing a nested element 3 levels deep using page objects

Deadly 提交于 2020-01-05 10:32:35
问题 Using the Page Object model and gem I want to access an element that is nested 3 layers deep. I've successfully accessed nested elements that are 2 elements deep but for 3 the same method isn't working. 3 elements defined in my Page Object: div(:serv_info, :class => "service-info") div(:validate_method, :class => "validate-method") div(:scar_input_group, :class => "input-group") So I tried to chain those 3 elements to access the div class input-container input-left-half round like this: div(

Masked Text Box issue

走远了吗. 提交于 2020-01-05 07:50:33
问题 i m using the rad masked control for phone field. telerik:RadMaskedTextBox ID="txtPhone1" runat="server" EnableAjaxSkinRendering="False" Mask="(###) ###-####" Skin="Hay" ZeroPadNumericRanges="False" MaxLength="20" TabIndex="30" Width="200px"></telerik:RadMaskedTextBox when i m trying to add phone using watir, using this code browser.text_field(:id => 'ctl00_ContentPlaceHolder1_Registration2_txtPhone1_text').set '7893457889' only last value has been added. kindly help me out. how to fill