watir

Is it possible to open a new tab in watir-webdriver?

旧城冷巷雨未停 提交于 2019-12-24 06:29:48
问题 The only thing that looks a bit like what I'm trying to achieve is this, but this works only for IE... for firefox I found that information, so is it not possible to open tabs, just new windows? And the attach method is accessing only already OPEN tabs/windows... Is there a way to decide to open a specific link in a new window/tab? I searched in the documentation, but I didn't find such a function... 回答1: Ok thats not a solution but a work-around: I switch to ruby mechanize, is quite

Is it possible to open a new tab in watir-webdriver?

大憨熊 提交于 2019-12-24 06:26:32
问题 The only thing that looks a bit like what I'm trying to achieve is this, but this works only for IE... for firefox I found that information, so is it not possible to open tabs, just new windows? And the attach method is accessing only already OPEN tabs/windows... Is there a way to decide to open a specific link in a new window/tab? I searched in the documentation, but I didn't find such a function... 回答1: Ok thats not a solution but a work-around: I switch to ruby mechanize, is quite

Encoding Problem when filling out a text_field with Watir in Ruby

烈酒焚心 提交于 2019-12-24 02:56:06
问题 I'm using Watir to fill out a text_field with the html-code that I have scraped with another program before. The language of the website-content that I'm transfering is German, so there are some special characters involved, that don't exist in the English alphabet. Those characters are displayed properly in the html-file, but when transfered into the text_field of the Joomla installation (I'm transfering a website to Joomla with this program), the special characters are not displayed properly

Get Elements By Attributes

爷,独闯天下 提交于 2019-12-24 02:25:45
问题 i will be short. As far as i know watir library provides two methods for getting html elements. Almost for each element (div, button, table, li, etc) watir provides two methods: . One is the 'singular' method which gets only one specific element. For example: watir_instance.div(:id,'my_div_id') watir_instance.link(:href,'my_link_href') watir_instance.button(:class =>'my_button_class', :index => 4) These methods will only retrieve A SINGLE ELEMENT. Thats ok... . The second is the 'plural'

Rubymine is not able to find a step definition, located inside a gem

怎甘沉沦 提交于 2019-12-23 22:30:23
问题 Rubymine returns an alert of "Undefined step reference" for the two steps of this scenario. This cucumber test is like this: @smoke Scenario: Update profile Smoke test. Given I navigate to this test webpage And In Test, I click the element of "test_link" This 2 steps are located inside a gem, following this structure: gemname/lib/features/step_definitions/web_shared_steps.rb And (/^I navigate to this (.*?)$/) do |web| web = '$' + web.downcase.gsub(' ', '_') @browser.goto eval(web) end Then (

Watir webdriver_unable to click Cancel Target button on popup window

那年仲夏 提交于 2019-12-23 04:45:52
问题 I am VERY new to Watir, trying to test a popup window and am unable to get my script to click the Cancel Target button. When running the script, I get an error: element not visible (Selenium::WebDriver::Error::ElementNotVisibleError . This is the script I am using: browser.div(:class => "modal-footer").button(:class => "btn btn-danger").click Below is the code: <div class="modal hide fade" id="target_modal" data-bind="with: target"> <div class="modal-header"> <button type="button" class=

How to download a file using Watir 6.0

ぃ、小莉子 提交于 2019-12-23 03:45:08
问题 I'm trying to download a CSV file with the new Watir 6.0. I found the profile settings for Firefox: profile = Selenium::WebDriver::Firefox::Profile.new profile['browser.download.folderList'] = 2 profile['browser.download.dir'] = path_to_download profile['browser.helperApps.neverAsk.saveToDisk'] = "text/csv" browser = Watir::Browser.new :firefox, :profile => profile But Firefox 50.0 doesn't support loading profile settings. I get this error message: /var/lib/gems/2.3.0/gems/selenium-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')

TDD的JavaScript单元测试工具

一个人想着一个人 提交于 2019-12-22 20:39:45
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我研究并考虑了许多JavaScript单元测试和测试工具,但一直无法找到合适的选项来保持与TDD的完全兼容。 那么,是否有一个完全符合TDD的JavaScript单元测试工具? #1楼 看一下 Dojo对象线束(DOH)单元测试框架 ,它是JavaScript单元测试的几乎与框架无关的工具,并且没有任何Dojo依赖项。 使用Dojo Objective Harness对Web 2.0应用程序进行单元测试时 ,对此有很好的描述。 如果要自动化UI测试(许多开发人员的 苦恼 ),请查看 doh.robot (临时向下更新:其他链接 http://dojotoolkit.org/reference-guide/util/dohrobot.html ) 和 dijit .robotx (暂时关闭) 。 后者专为验收测试而设计。 更新: 引用的文章介绍了如何使用它们,如何模拟用户使用鼠标和/或键盘与UI交互以及如何记录测试会话,以便以后可以自动“播放”它。 #2楼 作为专家,您可以“在实际的浏览器上运行”,但是根据我的经验,这是一个缺点,因为它运行缓慢。 但是,使之具有价值的是非浏览器替代品缺乏足够的JS仿真。 如果您的JS非常复杂,以至于仅在浏览器中进行测试就足够了,但是还可以考虑以下两个选项: HtmlUnit :

Ruby Watir — Trying to loop through links in cnn.com and click each one of them

天涯浪子 提交于 2019-12-22 12:14:14
问题 I have created this method to loop through the links in a certain div in the web site. My porpose of the method Is to collect the links insert them in an array then click each one of them. require 'watir-webdriver' require 'watir-webdriver/wait' site = Watir::Browser.new :chrome url = "http://www.cnn.com/" site.goto url box = Array.new container = site.div(class: "column zn__column--idx-1") wanted_links = container.links box << wanted_links wanted_links.each do |link| link.click site.goto url