watir-webdriver

How to click on specific element in canvas by its coordinates (using WebDriver)?

隐身守侯 提交于 2019-12-05 04:03:00
问题 I have a canvas element on my page and I want to click on specific (x, y) coordinates in this canvas. I use watir-webdriver: element = browser.driver.find_element(:id, 'canvas') browser.driver.action.move_to(element).move_by(x, y).click().perform But this code just clicks on the center of the canvas, not the specified (x, y) coordinates. What is wrong with it? UPD: So now I use this code: element = browser.driver.find_element(:id, 'canvas') browser.driver.action.move_to(element, x, y).perform

Save screenshot with Watir

*爱你&永不变心* 提交于 2019-12-05 03:40:54
问题 I am using Watir with Ruby on Rails. I need to save screenshots of couple of pages using Watir. I have managed to get the page that I want to open to show in a browser, but cannot save the screenshot yet. Here's my code: @browser = Watir::Safari.new folios_screenshot_path = Rails.root.join('screenshots/') @page = Page.find(5) cur_url = root_url + 'pages/' + @page.id.to_s @browser.goto cur_url @browser.div(:id => "page").wait_until_present @browser.driver.save_screenshot(pagess_screenshot_path

Cucumber embed for screenshots not linking to screenshot

ぐ巨炮叔叔 提交于 2019-12-05 03:27:49
问题 Cross-posted from the Cukes Google Group: I have experimented with a number of methods of saving screenshots, but settled on the method that is built into watir-webdriver. No matter which method I have used, I am not able to successfully embed a link to this image in the Cucumber HTML report. In c:\ruby\cucumber\project_name\features\support\hooks.rb, I'm using: After do |scenario| if scenario.failed? @browser.driver.save_screenshot("screenshot.png") embed("screenshot.png", "image/png") end

How to find the data-id in watir?

那年仲夏 提交于 2019-12-05 01:40:45
问题 I am new to watir testing. Would somebody help me to find the following element. <div class="location_picker_type_level" data-loc-type="1"> <table></table> </div> I like to find this div , data-loc-type with table exists. ex: browser.elements(:xpath,"//div[@class='location_picker_type_section[data-loc-type='1']' table ]").exists? 回答1: Watir supports using data- type attributes as locators (ie no need to use xpath). Simply replace the dashes with underscores and add a colon to the start. You

Save image in watir-webdriver

送分小仙女□ 提交于 2019-12-04 23:16:11
问题 I need to save image from recaptcha to localhost disk, i'm getting image dom element using watir-webdriver, but it doesn't support save method, as watir do. So how can i save image to my disk? Html: <div id="recaptcha_image" style="width: 300px; height: 57px;"> <img style="display:block;" alt="Проверка по слову reCAPTCHA" height="57" width="300" src="https://www.google.com/recaptcha/api/image?c=03AHJ_VusSUxF0IYURRcVTVTjJJnUk92j-hXYsuwqvu0m5tvKFzAnwvrHlz-j_Gfqg

How do I get watir-webdriver to start Firefox 4 with Firebug?

。_饼干妹妹 提交于 2019-12-04 20:53:33
问题 Any ideas? I've tried setting webdriver.firefox.useExisting=true as described in the link below hoping to reuse an existing window with firebug enabled, but no such luck. http://code.google.com/p/selenium/wiki/FirefoxDriver 回答1: you have to create a specific profile where Firebug is always enabled, then launch firefox with this profile in your configuration 回答2: The quick answer is: browser = Watir::Browser.new(:firefox, :profile => "default") But if you are running tests you probably shouldn

how to click a link in a table based on the text in a row

China☆狼群 提交于 2019-12-04 19:33:09
Using page-object and watir-webdriver how can I click a link in a table, based on the row text as below: The table contains 3 rows which have names in the first column, and a corresponding Details link in columns to the right: DASHBOARD .... Details EXAMPLE .... Details and so on. <div class="basicGridHeader"> <table class="basicGridTable">ALL THE DETAILS: ....soon </table> </div> <div class="basicGridWrapper"> <table class="basicGridTable"> <tbody id="bicFac9" class="ide043"> <tr id="id056"> <td class="bicRowFac10"> <span> <label class="bicDeco5"> <b>DASHBOARD:</b> ---> Based on this text <

Watir Web driver to download file

拜拜、爱过 提交于 2019-12-04 19:19:43
I'm writing Ruby script to automate Downloading files from a list of files using Watir web driver. Any pointers or approaches on Automating Popping up of Window and Directory Chooser to save the file into a location? Thanks. coloradoblue change default Watir preferences for download location for chrome profile = Selenium::WebDriver::Chrome::Profile.new download_dir = File.join(Rails.root, 'lib', 'assets') profile['download.default_directory'] = download_dir profile['download.prompt_for_download'] = false @b = Watir::Browser.new :chrome, :profile => profile for firefox profile = Selenium:

Watir-webdriver - Select a list display style: none

元气小坏坏 提交于 2019-12-04 18:03:45
Hi guys i've been trying to find a solution to my problem everywhere and can't find them. I need to select a value from the second select in this html code, the one that has name="update_status[5955483]" and i don't know how. What i've tried without success. Watir: 1- browser.select_list(:name, "update_status[5955483]").select_value("A") 2 - input_field = browser.div(:class => 'minict_wrapper orange') input_field.link(:name => 'update[5955483}]' ).click 3 - browser.input( :value, "B").click Nothing have worked, the first one's give me error on finding element, the third one just click's on the

How do I scrape data from a page that loads specific data after the main page load?

只谈情不闲聊 提交于 2019-12-04 17:23:35
I have been using Ruby and Nokogiri to pull data from a URL similar to this one from the hollister website: http://www.hollisterco.com/webapp/wcs/stores/servlet/TrackDetail?storeId=10251&catalogId=10201&langId=-1&URL=TrackDetailView&orderNumber=1316358 My script looks like this right now: require 'rubygems' require 'nokogiri' require 'open-uri' page = Nokogiri::HTML(open("http://www.hollisterco.com/webapp/wcs/stores/servlet/TrackDetail?storeId=10251&catalogId=10201&langId=-1&URL=TrackDetailView&orderNumber=1316358")) puts page.css("h3[data-property=GLB_ORDERNUMBERSYMBOL]")[0].text My problem