watir-webdriver

How to backup browser state after Watir automation

自闭症网瘾萝莉.ら 提交于 2019-12-07 19:46:42
问题 Summary of tools: watir-webdriver 1.8.17 Mac OS X 10.7.3 Chrome 18.0.1025.151 I'm currently using Watir WebDriver to automate Chrome sessions across a number of websites. I need to backup the state of the web browser (cookies, cache, etc.) at certain points throughout the session. Originally, I figured I could do this with Ruby's file IO library by copying ~/Library/Application Support/Google/Chrome/Default at the necessary points. However, it does not appear that Chrome sessions created with

Script running on chrome showing errors

◇◆丶佛笑我妖孽 提交于 2019-12-07 19:10:29
问题 I used steps to run chrome script provided on this links its showing error I Installed chrome driver as steps suggested in below link but its not working https://github.com/zeljkofilipin/watirbook/blob/master/installation/windows.md#chrome-with-watir-webdriver My PC configuration Win 7 & 64bit C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.9-x86-mingw32/lib/ffi/platform.rb:27 : Use RbConfig instead of obsolete and deprecated Config. Started ChromeDriver port=54035 version=20.0.1133.0 log=D:

Watir implicit_wait doesn't seem to work

◇◆丶佛笑我妖孽 提交于 2019-12-07 17:53:53
问题 We are currently using watir-webdriver (0.6.2) with firefox to run acceptance tests. Our tests take a long time to run, and often fail with timeout errors. We wanted to decrease the timeout time, for them to fail faster. We tried: browser = Watir::Browser.new("firefox") browser.driver.manage.timeouts.implicit_wait=3 However, we are still experiencing 30s timeouts. We couldn't find any documentation or question regarding this issue. Does anyone know how to configure Watir waiting timeouts

watir-webdriver change proxy while keeping browser open

心不动则不痛 提交于 2019-12-07 13:24:21
问题 I am using the Watir-Webdriver library in Ruby to check some pages. I know I can connect through a proxy using profile = Selenium::WebDriver::Firefox::Profile.new#create a new profile profile.proxy = Selenium::WebDriver::Proxy.new(#create proxy data for in the profile :http => proxyadress, :ftp => nil, :ssl => nil, :no_proxy => nil ) browser = Watir::Browser.new :firefox, :profile => profile#create a browser window with this profile browser.goto "http://www.example.com" browser.close However,

How to download a file using Watir 6.0

早过忘川 提交于 2019-12-07 01:05:30
I'm trying to download a CSV file with the new Watir 6.0. I found the profile settings for Firefox: profile = Selenium::WebDriver::Firefox::Profile.new profile['browser.download.folderList'] = 2 profile['browser.download.dir'] = path_to_download profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv" browser = Watir::Browser.new :firefox, :profile => profile But Firefox 50.0 doesn't support loading profile settings. I get this error message: /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in `initialize': unknown option: {:profile=>#

Watir Web driver to download file

依然范特西╮ 提交于 2019-12-06 14:24:42
问题 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. 回答1: 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'] =

Watir-webdriver - Select a list display style: none

喜夏-厌秋 提交于 2019-12-06 09:52:23
问题 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

watir print/put all visible links

匆匆过客 提交于 2019-12-06 09:46:54
$browser.links.each do |link| puts link.attribute_value("class") end How do I get all the visible/existing links in the put statement? You can also write it by using shorter syntax like this: puts $browser.links.find_all(&:present?).map(&:class_name) This will output value of class attribute for all existing links on the page: $browser.links.each {|link| puts link.attribute_value("class")} This will output value of class attribute for all visible links on the page: $browser.links.each {|link| puts link.attribute_value("class") if link.visible?} If you require the class name of the links, you

Selenium WebDriver Change Firefox path to Tor

爷,独闯天下 提交于 2019-12-06 09:34:48
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. The following worked for me with selenium-webdriver 2.48.1 and Tor Browser Bundle 5.0.3 on Ubuntu Linux 15.04. require 'selenium-webdriver'

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

不羁的心 提交于 2019-12-06 09:09:33
问题 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