watir

Cannot click html element with watir

孤街浪徒 提交于 2019-11-29 18:13:05
I want to click the "button" below, but cannot click it. The html is: <table onclick="filtersJob_intrinsic_extender.addRow();return false;" class="FilterList_addLink"> <tbody> <tr> <td class="icon"><img src="/commander/lib/images/icn12px_add.gif" alt="Add Filter"></td> <td class="text">Add Intrinsic Filter</td> </tr> </tbody> </table> I am basically doing this with watir and watir-webdriver: browser.td(:text => 'Add Intrinsic Filter').click I tried this method on another similar button in another website and it worked. I wonder why it does not work here. It causes the exception: Selenium:

Stylesheets not applied in Chrome

£可爱£侵袭症+ 提交于 2019-11-29 17:34:11
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] I assume that you are accessing the application-under-test via embedded credentials. Chrome v59 removes support for embedded credentials in subresource requests. Here's what the

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

和自甴很熟 提交于 2019-11-29 14:35:35
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 start Selenium / Watir with Watir::Browser.new :chrome or Watir::Browser.new :chrome, headless:true I get

Using class names in Watir

你说的曾经没有我的故事 提交于 2019-11-29 13:06:20
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 errors I was just wondering why this was so difficult, to where using ids on everything seems to be the

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

痴心易碎 提交于 2019-11-29 12:44:44
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 was the HTML for which I was able to solve using "@ie.div(:class,'GridElementInlineIE').fire_event(

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 .

How to upload a file with watir and IE?

本小妞迷上赌 提交于 2019-11-29 06:57:43
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 ie = @browser htmlfile = "C:\\testing\\upload.html" uploadfile = "C:\\testing\\upload.html" ie.goto

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 specify the location of the chromedriver binary

纵然是瞬间 提交于 2019-11-29 03:56:01
Earlier I had put the Chrome binary, "chromedriver.exe", in the "C:/Windows" directory and Watir was picking it from there. Now I have to move my project to another machine so I can't hardcode the executable path. I also want the binary to be kept with our code on Git rather than making each test engineer manually update the binary as newer versions are released. Now I have placed Chrome binary at a absolute path, but it is not being found. Here is what I tried (hooks.rb): Before do puts "inside hooks in before" profile = Selenium::WebDriver::Chrome::Profile.new profile['download.prompt_for

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