watir-webdriver

watir cannot create internet explorer browser - Enable Protected Mode issue

社会主义新天地 提交于 2021-02-10 14:26:50
问题 I am using the following code snippets to create internet explorer browser and do some testing. I am not able to create ie browser because of the exception given below. How do I fix this? require 'rubygems' require 'watir-webdriver' require 'phantomjs' client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 300 browser = Watir::Browser.new :ie, :http_client => client browser.goto "some url" Error - Started InternetExplorerDriver server (32-bit) 2.29.0.0 Listening on port 5555

Cucumber: How to run the After hook only once after all examples in scenarion_outline

不问归期 提交于 2021-02-08 10:16:16
问题 I have a scenario_outline which tests login screen of a website. Scenario_outline: Try to login Verify login Examples: | User | Pass | | user1 | pass1 | | user2 | pass2 | I want to be able to start the web page at the beginning and close if after all examples are done. Running the Before hook is easy Before do $start ||= false if ! start #start web page $start = true end end But how do i run my After hook only once after all scenarios are done? After do #close web page end The above example

Unable to use OptionParser and rspec

和自甴很熟 提交于 2021-01-28 05:08:13
问题 I have a simple watir (web-driver) script which goes to google. But, I want to use option parser to set an argument in the cmd to select a browser. Below is my script: require 'optparse' require 'commandline/optionparser' include CommandLine require 'watir-webdriver' describe 'Test google website' do before :all do options = {} opts = OptionParser.new do |opts| opts.on("--browser N", "Browser to execute test scripts") do |n| options[:browser] = n $b = n.to_s end end opts.parse! ARGV p options

how to scroll a web page using watir

老子叫甜甜 提交于 2020-01-31 04:31:15
问题 I am trying to scroll a web page to find and click on a content that is lazily loaded when the page is scrolled. I am using following command require 'watir-webdriver' @browser = Watir::new :firefox @browser.send_keys :space I am using web-driver with firefox and I am on ubuntu but it is not working. In the following ruby code I am trying to scroll the page down until I don't find the element with :id. The element is loading lazily. I am getting timeout after few seconds, any idea what is

Native Events error trying to double-click element using watir-webdriver

a 夏天 提交于 2020-01-16 19:08:07
问题 I am writting automatic test for GWT application. And I try to double click on table element. I am using this code fo click: browser.element(:xpath, '/html/body/div[5]/div[2]/div/div/div/div[2]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/table/tbody[2]/tr[1]/td[1]/div').double_click When this command is executed I get error like: test_search(TC_article_example):Selenium::WebDriver::Error::InvalidElementStateError: Cannot perform native interaction: Could not load native events

mootools, watir webdriver onmouseover take no effect

淺唱寂寞╮ 提交于 2020-01-15 10:57:06
问题 My test shows that webdriver fire_event("onmouseover") takes no effect when page has mootools lib. when remove mootools lib, fire_event("onmouseover") takes effect. how can I get a workaround? html page is following: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <script type='text/javascript' src='http://demos111.mootools.net/demos/mootools.svn.js'></script></head> <body> <div onmouseover="document.getElementById('id6').style.display=

Watir: get sometimes a Net::ReadTimeout error by launching chrome browser

大兔子大兔子 提交于 2020-01-14 19:05:13
问题 I just use a watir script to download sequential status infos from a server. In most cases it works fine, but sometimes I get an Net::ReadTimeout error. I don't know why? Code: require "rubygems" require "watir" Watir.default_timeout = 180 # seconds – default is 60 prefs = { :download => { :prompt_for_download => false, :default_directory => path } } browser = Watir::Browser.new :chrome, :switches => %w[--no-sandbox], :prefs => prefs browser.goto 'https://www...' ... Error Message: /usr/lib

Watir: get sometimes a Net::ReadTimeout error by launching chrome browser

自闭症网瘾萝莉.ら 提交于 2020-01-14 19:04:43
问题 I just use a watir script to download sequential status infos from a server. In most cases it works fine, but sometimes I get an Net::ReadTimeout error. I don't know why? Code: require "rubygems" require "watir" Watir.default_timeout = 180 # seconds – default is 60 prefs = { :download => { :prompt_for_download => false, :default_directory => path } } browser = Watir::Browser.new :chrome, :switches => %w[--no-sandbox], :prefs => prefs browser.goto 'https://www...' ... Error Message: /usr/lib

Watir: get sometimes a Net::ReadTimeout error by launching chrome browser

瘦欲@ 提交于 2020-01-14 19:04:06
问题 I just use a watir script to download sequential status infos from a server. In most cases it works fine, but sometimes I get an Net::ReadTimeout error. I don't know why? Code: require "rubygems" require "watir" Watir.default_timeout = 180 # seconds – default is 60 prefs = { :download => { :prompt_for_download => false, :default_directory => path } } browser = Watir::Browser.new :chrome, :switches => %w[--no-sandbox], :prefs => prefs browser.goto 'https://www...' ... Error Message: /usr/lib

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

折月煮酒 提交于 2020-01-12 10:47:58
问题 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