watir-webdriver

How to get WIN32OLE handle for IE via watir-webdriver?

巧了我就是萌 提交于 2019-12-23 02:16:28
问题 In Watir you can get WIN32OLE handle of IE window using next method. irb(main):059:0> browser.ie => #<WIN32OLE:0x28d12b8> I need somehow to get same return for IE that was created by watir-webdriver. Is there some way? Or at least someone can point me the direction to dig. I need this stuff to attach HTTPwatch plugin to my browser instance. Here is example of HTTPWatch code. require 'watir' require 'win32ole' browser = Watir::Browser.new controller = WIN32OLE.new('HttpWatch.Controller')

How to simulate CTRL+Click with watir-webdriver?

寵の児 提交于 2019-12-21 18:47:14
问题 I want to simulate ctrl keydown and ctrl keyup. My use-case is the following: The user can select from a list (build with a table) multiple elements by pressing CTRL key and clicking on the desired row. When the CTRL key is released an AJAX call will be made. I need a watir test to simulate this. How can i do this ? Any ideas ? I would need a solution that works under Linux Thanks a lot. 回答1: I believe the best way to send comands would be to do the following: require 'watir-webdriver'

Watir-Webdriver Wait for Download to Complete

匆匆过客 提交于 2019-12-21 09:09:01
问题 I am using Watir-Webdriver with Firefox and the method recommended on the watirwebdriver.com site to automate file downloads. This involves setting FireFox about:config parameters to disable the download dialog in FireFox for specific file types. This works well but now I am trying to figure out how best to determine when the file download has completed (some take a few seconds, some take minutes) so I can logout of the site and move on to the next test. It seems since there are no visual

Watir Webdriver counting number of items in a UL list

吃可爱长大的小学妹 提交于 2019-12-21 09:08:12
问题 I've done a few searches and I'm unable to find a suitable answer. Basically I have an unordered list which can be of a varying length. I want to iterate through the list, do some other things and then come back and select the next item on the list. I can do this fine when I define the amount of times my loop should iterate as I know the amount of items in the list. However I don't want to define this for each test, I want to grab the number of items in the list and then pop that into a

Make headless browser stop loading page

自作多情 提交于 2019-12-21 04:19:05
问题 I am using the watir-webdriver ruby gem. It starts the browser (Chrome) and begins to load a page. The page is loading too slowly, and watir-webdriver raises a timeout error. How can I make the browser stop loading the page? require 'watir-webdriver' client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 10 @browser = Watir::Browser.new :chrome, :http_client => client sites = [ "http://google.com/", "http://yahoo.com/", "http://www.nst.com.my/", # => This is the SLOW site

How to enter password in a popup using watir?

故事扮演 提交于 2019-12-20 16:49:46
问题 I'm writing some watir test cases: browser.goto "http://egauge2592.egaug.es/" browser.link(:href,"/settings.html").click browser.text_field(:index,4).set("some text") browser.button(:id,"save_button").click then a 'Authentication Required' dialogue opens, asking for username and password . No matter how I tried, I couldn't access the text fields. I tried send_keys and JavaScript. I also tried Watir.autoit but it says undefined method. I'm using watir on a Ubuntu machine with the FireFox

watir-webdriver - clicking Javascript button

蓝咒 提交于 2019-12-20 03:27:36
问题 First week with watir-webdriver and Web app testing in general, so still trying to wrap some concepts around. Having this javascript element: <input type="submit" class="button" value="Search" name="_target0"> browser.button(:value, "Search").exists? => "true" browser.button(:value, "Pesquisar").present? => true browser.button(:name, "_target0").value => "Search" This doesn't actually drive the button to get clicked, browser.button(:name, "_target0").click So I got the driven Firefox clicking

How to disable download window in firefox with watir-webdriver?

爱⌒轻易说出口 提交于 2019-12-20 03:19:28
问题 I don't want to handle download window in Firefox or IE. I want to auto download the excel file without any download window. I have tried to set several configuration parameters for Firefox, but it didn't work. In my test I'm trying to download excel file profile = Selenium::WebDriver::Firefox::Profile.new profile['browser.download.lastDir'] = 'C:\\Downloads' profile['browser.download.folderList'] = 2 profile['browser.download.dir'] = 'C:\\Downloads' profile['download.prompt_for_download'] =

Timeout::Error in Rails application using Watir

我是研究僧i 提交于 2019-12-20 02:29:26
问题 I am using Watir to browse pages and take screenshots of some pages in my application. However, getting a page from my server takes a while, and I get Timeout::Error. To fix this, I used a wait in my Watir browser instance, to check to see if a div with id 'content' exists, and to make it wait until it exists. However, it takes some time, and the page is loaded in the Watir browser. But after it is loaded, I get the Timeout::Error in my main browser window. Here's my code: @pages = Pages.all

Is it possible to globally increase Watir-Webdriver when_present wait time?

醉酒当歌 提交于 2019-12-19 18:56:22
问题 I am writing an automated testing program which will test some web programs that are sometimes slow to load certain AJAX calls. For instance the user will click 'Query' which will result in a HTML 'loading' overlay for anywhere from 15 to 90 seconds. When the search completes, it will then update a table on the same page with the results. So obviously I can increase the waiting time individually like so: browser.td(:id => 'someId').when_present.some_action #=> will wait 30 seconds browser.td(