watir-webdriver

How might I simulate a private browsing experience in Watir? (Selenium)

别等时光非礼了梦想. 提交于 2019-11-29 08:49:09
Watir is a Selenium-based black-box testing tool that can automate tasks on the browser. I would like to be able to open up a Watir::Browser.new that is in private browsing mode. Thanks For Firefox (I am not sure about the other browsers), you can setup the profile to have private browsing enabled: profile = Selenium::WebDriver::Firefox::Profile.new profile['browser.privatebrowsing.dont_prompt_on_enter'] = true profile['browser.privatebrowsing.autostart'] = true b = Watir::Browser.new :firefox, :profile => profile This was the solution from https://github.com/watir/watir-webdriver/issues/95 .

Stop loading page watir-webdriver

岁酱吖の 提交于 2019-11-29 05:18:02
Is there a way to stop loading a page with watir-webdriver on firefox? Or is there a way to force something in my script even if the page is still loading? At a point in my script, the website will hang and the script eventually timeouts. You can use the Timeout class to force it to give up after waiting a reasonable amount of time (and this is internally how Watir performs it's waits as well) begin Timeout::timeout(10) do # perform actions that may hang here end rescue Timeout::Error => msg put "Recovered from Timeout" end If the website hangs, you should be able to use a wait method to

How to click on a specific coordinates of an element

拥有回忆 提交于 2019-11-29 04:23:54
I need click on a specific coordinates of a element with watir-webdriver . With selemium-webdriver it will be looks like: @driver.action.move_to(element, 30, 0).click.perform But how do it with watir ? I think you will have to access the selenium-webdriver driver directly (assuming browser is your watir-webdriver browser): browser.driver To get the underlining selenium-webdriver element for a watir-webdriver element, use wd (assuming element is your watir-webdriver element you want to click): element.wd Putting it all together, you would do: browser.driver.action.move_to(element.wd, 30, 0)

Check if “Please enter an email address” message appears

不打扰是莪最后的温柔 提交于 2019-11-28 23:55:05
Given a simple page: <form> <input type="email"> <button>click</button> </form> If I enter anything in text field that is not e-mail and click the button, Please enter an email address message appears. Is there a way to to check if the message appears using Selenium or Watir? As far as I see, nothing new appears in browser DOM. Since the page is using e-mail check that is built in feature of a browser, does it even make sense to check that error message appears? It is at the same level as checking if browser scroll bar works. We are no longer checking the web application, but the platform

Stylesheets not applied in Chrome

只谈情不闲聊 提交于 2019-11-28 12:40:56
问题 Using Watir with Chromedriver. When running tests (not headless), my stylesheets are not applied. When running chrome normally (not testing) my stylesheets show up. What's the deal? This didn't happen yesterday. Specs: Ubuntu 16.04 LTS Chrome Version 59.0.3071.104 (Official Build) (64-bit) ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57) watir 6.2.1 ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu] 回答1: I assume that you are accessing the application-under-test via embedded

selenium scroll element into (center of) view

谁说我不能喝 提交于 2019-11-28 12:00:28
When an element is out of view with selenium and one tries to interact with it, selenium will usually scroll the element into view first implicitly. This is great except that what is annoying is that it usually puts in the element just enough into view. What I mean is that if the element is below the window, it will scroll down enough just till when the element is just bordering the edge of the window. Usually this is fine, but when working on a web site with borders around it, this will lead to numerous of these kinds of errors Selenium::WebDriver::Error::UnknownError: unknown error: Element

Setting browser window size in Watir-webdriver

女生的网名这么多〃 提交于 2019-11-28 06:25:52
How can you specify the size of the browser window opened when you call the following with watir-webdriver? browser = Watir::Browser.new(:firefox) This works only for Firefox at the moment: browser.window.resize_to(800, 600) and you can move the browser, too: browser.window.move_to(0, 0) Alexey Klimchuk I'm using ruby+watir-webdriver and this code works for both FF and IE browsers (I have not checked in others browsers) screen_width = browser.execute_script("return screen.width;") screen_height = browser.execute_script("return screen.height;") browser.driver.manage.window.resize_to(screen

Opening several threads with watir-webdriver results in 'Connection refused' error

∥☆過路亽.° 提交于 2019-11-28 03:52:16
问题 I have this simple example: require 'watir-webdriver' arr = [] sites = [ "www.google.com", "www.bbc.com", "www.cnn.com", "www.gmail.com" ] sites.each do |site| arr << Thread.new { b = Watir::Browser.new :chrome b.goto site puts b.url b.close } end arr.each {|t| t.join} Every time i run this script, I get ruby/2.1.0/net/http.rb:879:in `initialize': Connection refused - connect(2) for "127.0.0.1" port 9517 (Errno::ECONNREFUSED) Or one of the browsers closes unexpectedly on atleast one of the

How might I simulate a private browsing experience in Watir? (Selenium)

三世轮回 提交于 2019-11-28 02:31:36
问题 Watir is a Selenium-based black-box testing tool that can automate tasks on the browser. I would like to be able to open up a Watir::Browser.new that is in private browsing mode. Thanks 回答1: For Firefox (I am not sure about the other browsers), you can setup the profile to have private browsing enabled: profile = Selenium::WebDriver::Firefox::Profile.new profile['browser.privatebrowsing.dont_prompt_on_enter'] = true profile['browser.privatebrowsing.autostart'] = true b = Watir::Browser.new

Disable chrome download multiple files confirmation

≡放荡痞女 提交于 2019-11-28 01:50:48
I developed a crawler with ruby watir-webdriver that downloads some files from a page. My problem is that when I click to download the second file, Chrome opens a bar in the top asking for confirmation that I am downloading multiple files from this website. Once this is used by webdriver, I cannot confirm the download. Is there anyway to avoid this confirmation? I am thinking if is there any configuration to avoid it or if is there an extension to do this or even if I can click on the confirmation with webdriver. thanks I'm using Chrome 49 and none of the other solutions worked for me. After