watir

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

Ruby / Heroku Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9516

不羁的心 提交于 2019-11-28 08:19:15
问题 I'm trying to run headless chrome on Heroku with ruby. I've installed the buildpacks https://github.com/heroku/heroku-buildpack-google-chrome/ and https://github.com/heroku/heroku-buildpack-chromedriver and have set the Selenium driver_path to the correct location (I've checked this as before setting the Selenium driver path I get cannot find Chrome binary , after setting it to the GOOGLE_CHROME_BIN variable set by the buildpack I get the unable to connect to chromedriver ). When I try to

Using class names in Watir

送分小仙女□ 提交于 2019-11-28 06:54:44
问题 So our QA guy came by today to get me to put id's on items in our html so he could automate stuff using watir. I don't know much about it, so I tried to see if we could use the class names instead, but that's a total crapshow. I was just wondering why something like link(:item, :id => 'save-btn') works when you set it up in watir, but you can't do something like links(:item, :class => 'save-btn')[0] I also tried using the browser.links calls, but we would consistently get element not visible

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

Watir: Need to double click on an element to open custom popup

六眼飞鱼酱① 提交于 2019-11-28 05:55:25
问题 I am a newbie in WATIR. The problem I am facing is - The application I am testing has thumbnails (like Windows icons) placed on the page and I need to double click it. On doing that, an custom popup (ajax popup implemented in javascript) will open. The fire_event("ondblclick") is not working for me. I also tried 'click' twice but that too is not helping. Is there any other way of handling this? Your help is highly appreciated. Added 6 July 2010: I solved it but I have another query now. Below

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

How to upload a file with watir and IE?

馋奶兔 提交于 2019-11-28 00:46:26
问题 I am writing a watir script to test an upload form. But the script does not automatically choose the file that is to be uploaded from my harddrive. Instead IE stops with the file chooser dialog open. As soon as I manually select the to be uploaded file in the dialog and click ok, watir continues as desired. I wonder why it stops. This is my watir script: require 'test/unit' require 'watir' # runs on win3k, IE 6.0.3790; ruby 1.8.6, watir class EpcHomePage < Test::Unit::TestCase def test_upload

Check if “Please enter an email address” message appears

不羁的心 提交于 2019-11-27 21:22:46
问题 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

How do I use Watir::Waiter::wait_until to force Chrome to wait?

橙三吉。 提交于 2019-11-27 12:24:09
问题 I'm trying to tell my watir script to wait for an ajax-injected login box to open up. I am using watir-webdriver, and testing in Chrome. I cannot get wait_until to work, as commented in the below (simplified) script. require "rubygems" require "watir-webdriver" b = Watir::Browser.new(:chrome) site = "www.example.com" b.goto site puts "Click on Sign In button" b.link(:id, 'btnLogin').click puts "Waiting for the username/password dialog to show up" # Below line does *not* work # Throws this