watir

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

How to scroll within a table using watir-scroll

牧云@^-^@ 提交于 2021-02-10 06:41:08
问题 I have an application in which there is a dynamic table, rows are loaded only when you scroll up or down. Watir-scroll is scrolling the entire page. Is there anyway I can perform the scrolling within that table? 回答1: Making an element scrollable is often done by setting the overflow style. It is likely on a div that contains the table . For example: <html> <body> <div style="overflow:scroll; height:250px;"> <table> <tr height="200px"><td>Cell A</td></tr> <tr height="200px"><td>Cell B</td></tr

Testing with watir chromedriver failed with Sec-Fetch-User in Request Headers

依然范特西╮ 提交于 2021-02-08 09:17:17
问题 I am using watir for testing an internal application. The testing recently stops working. These are the simplified steps of the test: require 'watir' Selenium::WebDriver::Chrome.path = 'PATH_TO_CHROME_EXE' browser = Watir::Browser.new :chrome, :options => {:options => {'useAutomationExtension' => false}} URL = "TEST_URL" browser.goto URL After the goto line executed, the browser failed to navigate to the page. When inspecting the network activity, The request status showing as canceled. I

Testing with watir chromedriver failed with Sec-Fetch-User in Request Headers

可紊 提交于 2021-02-08 09:13:58
问题 I am using watir for testing an internal application. The testing recently stops working. These are the simplified steps of the test: require 'watir' Selenium::WebDriver::Chrome.path = 'PATH_TO_CHROME_EXE' browser = Watir::Browser.new :chrome, :options => {:options => {'useAutomationExtension' => false}} URL = "TEST_URL" browser.goto URL After the goto line executed, the browser failed to navigate to the page. When inspecting the network activity, The request status showing as canceled. I

Ruby : Watir : How to avoid closing browser from Net::ReadTimeout?

淺唱寂寞╮ 提交于 2021-02-07 08:55:19
问题 I am making an automation program using Watir , that reads links from a file links.txt and then open one by one on chrome browser. When it takes to much time to open then browser and its on loading time it shows me the Net::ReadTimeout . I have tried to rescue and and if its not rescued go to the next link from the list. I have tried this one but when max_retries = 3 it shows again the error. I want to make browser to wait for specific amount of time and then if it is still loading close the

How to click on link element after i element with specific text using watir?

被刻印的时光 ゝ 提交于 2021-01-29 12:29:15
问题 For this type of link I am happily using @browser.link(:text => "Reports").when_present.click <a href="/Reports/">Reports</a> However I am struggling with this example <a href="#"> <i class="no-icon"></i> Staff <img src="/Images/Menu/arrow.gif" class="arrow"> </a> I am wanting to click the link by text also but it is not found due to i element. I do not want to use xpath so can anyone advise a better way please. Thanks 回答1: The given below code works for me fine. browser.link(text: "Staff")

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

javascript error: Cannot read property 'toLowerCase' of undefined

妖精的绣舞 提交于 2021-01-07 02:11:16
问题 I am trying to interact the shadow DOM from WATIR code. I used JustinKo's solution as shown below. But it is throwing the following error Backtrace:: javascript error: Cannot read property 'toLowerCase' of undefined (Selenium::WebDriver::Error::JavascriptError) when the program meets this line Watir.element_class_for(element.tag_name.downcase).new(scope, element: element) My program require 'watir' # Monkey-patch due to being unable to check the tag name of the shadow root class Watir:

javascript error: Cannot read property 'toLowerCase' of undefined

落花浮王杯 提交于 2021-01-07 02:01:14
问题 I am trying to interact the shadow DOM from WATIR code. I used JustinKo's solution as shown below. But it is throwing the following error Backtrace:: javascript error: Cannot read property 'toLowerCase' of undefined (Selenium::WebDriver::Error::JavascriptError) when the program meets this line Watir.element_class_for(element.tag_name.downcase).new(scope, element: element) My program require 'watir' # Monkey-patch due to being unable to check the tag name of the shadow root class Watir:

How to access and interact with Shadow DOM using Watir?

半城伤御伤魂 提交于 2020-12-26 11:14:19
问题 I need to access this page chrome://downloads/ and check that a file has been downloaded but it's Shadow DOM. I've found this article how to access DOM Elements With Selenium Webdriver. http://jeremysklarsky.github.io/blog/2015/06/13/accessing-shadow-dom-elements-with-selenium-webdriver/ But this is written in JS driver.executeScript("return $('body /deep/ <#yourSelector>')") driver.executeScript("return $('body /deep/ ._mm_column')[0].textContent").then(function(title){ title.should.contain