When you try to install watir 2.0.4, it will grab the latest version of the
win32-process gem (and other dependencies) unless you already have one
installed. Currently the win32-process gem is at version 0.7.0, which you
do not want. So the solution is to manually install a prior version of the
To reproduce the SystemStackError error, you can use the w3schools page:
require 'watir-classic'
browser = Watir::Browser.new
browser.goto('http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select')
browser.frame(:name, 'view').select_list.select('Saab')
Or if you want to do it locally,
formats for some of the properties (example 'color').
Justin Ko
On Friday, October 26, 2012 6:26:53 AM UTC-4, Connor C wrote:
Hey Jarmo or whoever else can help :),
In the latest wair-classic the Element#style() method works as follows
# return the css style as a string
def style
The page object gem automatically creates a method for checking existence -
see the docs
http://rubydoc.info/github/cheezy/page-object/master/PageObject/Accessors#link-instance_method.
So for:
link(:signout, :text = 'Sign Out')
There should be able to do:
signout?
- Justin Ko
On Friday
Are you using Firefox? I had this problem after updating Firefox to version
17.
Upgrading to the latest version of selenium-webdriver (2.27.2) fixed the
issue for me.
Justin
On Wednesday, December 12, 2012 12:15:56 PM UTC-5, Abe Heward wrote:
Note that I am using Watir-webdriver 0.6.2
On
)
rescue MiniTest::Assertion
p Batdog to the Rescue!
end
end
end
- Justin Ko
On Wednesday, December 19, 2012 10:35:26 AM UTC-5, captin wrote:
Thank you for your reply and for taking the time to assist me. As I stated
in my OP, I'm new to watir. I've come across RSpec and Cucumber
That same code will work in watir-classic.
The execute_script method exists in watir-classic and navigator.userAgent
is supported in all major browsers
(http://www.w3schools.com/jsref/prop_nav_useragent.asp).
- Justin Ko
On Monday, January 28, 2013 11:49:16 AM UTC-5, Dan wrote
In watir-webdriver, you would have to use the attribute_value method:
browser.text_field.attribute_value('maxlength')
Justin
On Tuesday, February 12, 2013 12:51:03 AM UTC-5, Phuoc Can Hua wrote:
I used to use textField().maxlength in my scripts. Now I've changed it to
use
Based on the exception, it looks like you are on selenium-webdriver version
2.29.0. You should probably try upgrading to the latest version, which is
2.32.1.
Justin
On Thursday, April 18, 2013 5:45:04 AM UTC-4, gu...@dna-7.com wrote:
Hello,
I use Watir and the Chrome Webdriver in my unit
').each_with_index do |tr, i|
if tr.css('td').collect(:text) == myArray
puts Row to click: #{i}
end
end
puts Time to finish: #{Time.now - start}
#Output:
# Row to click 30
# Time to finish: 0.091
- Justin Ko
On Friday, July 12, 2013 5:49:07 PM UTC-4, Super Kevy wrote:
OK. I ran
,
there is no automatic integration with the Watir browser (ie you have to
manually pass the Watir html to the WatirNokogiri parser).
- Justin Ko
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
watir-general@googlegroups.com
http
I created an issue for this -
https://github.com/watir/watir-classic/issues/64
In the short term, I think the best solution might be to simply monkey
patch a focus method in for the modal dialog. This would address the
exception without impacting focusing of elements in the regular part of the
You can use the generic element accessor, which is in the form
element(:name, :tag_name, :identifier = 'value'). For example:
element(:fckeditor, :frame, :id = 'editor')
This would let you do:
fckeditor_element.send_keys(This is my text)
Note that you can also locate the element directly,
tells Watir to wait for the element to appear
before setting it.
- Justin Ko
On Monday, November 24, 2014 5:49:02 PM UTC-5, Alberto Magalhães wrote:
same error :-(
require 'watir-webdriver'
browser = Watir::Browser.new :chrome
browser.goto(https://www.santandertotta.pt/pt_PT
You can use the `content` method to return the value of the content
attribute:
p browser.meta.content
#= this is variable
Justin
On Tuesday, December 16, 2014 11:41:23 AM UTC-5, christina wrote:
Hi,
meta name=description content=this is variable
Hi Please can one help me an tell how can
2.39.0 (ie
the last release with support for Firefox 25). Depending on the changes,
you may or may not also need to downgrade Watir-Webdriver to match.
Justin Ko
On Tuesday, March 17, 2015 at 9:02:49 AM UTC-4, Joe Fl wrote:
Hi Titus,
Thanks for responding. I gave that a try and still
('HttpWatch.Controller')
plugin = control.IE.Attach(ie.ie)
# Start recording
plugin.Record()
# Drive the browser
ie.goto('www.google.ca')
# Stop recording
plugin.Stop()
# Save the log file
plugin.Log.Save('C:\Documents and Settings\Setup\Desktop\log.hwl')
# Close IE
ie.close
- Justin Ko
On Tuesday
b.url
end
- Justin Ko
On Monday, June 29, 2015 at 1:40:30 PM UTC-4, Sergiu Cornea wrote:
Good afternoon guys,
I was wondering if someone could help me.
Please correct me if I am wrong as I have just started learning Watir and
Ruby.
Lets say I have 20 websites to be checked but I don't
The exception is saying that there is no method `table` for
`@adl_name_search`. Are you sure you are calling the `table` method for the
right object? It should be called for a Watir::Browser or a Watir::Element.
Once you do get the table element, you can iterate through each td element
by
of the
other attributes instead. For example:
browser.element(aria_label: 'Remove').click
- Justin Ko
On Tuesday, July 14, 2015 at 8:49:34 AM UTC-4, Mahesh Mesta wrote:
Hi,
I am very new to watir. I have been trying to test the edit profile of an
application.I need to set and clear
Last time I checked, Webdriver did not have full support for uploading
multiple files.
For at least Chrome, a workaround was to use `send_keys` and deliminate the
files using "\n":
browser.file_field.send_keys("full/path/file1.txt \n full/path/file2.txt")
- Justin Ko
On
not contain data_form.yml) and it is not
likely to be relative to env.rb
- Justin Ko
On Monday, July 11, 2016 at 3:49:14 PM UTC-4, Ajay Reddy wrote:
>
> Hello All,
> I am getting this error "cannot load such file
> -/pages/Config/data/data_form.yml (LoadError)", can any one fi
and "Feeling Lucky" button. However, when
> I change it to any reasonable id I discover when using GoogleChrome
> Developer Inspect Tool. I get various errors, including selenium
> ElementNotVisibleError, and Watir UnknownMethodException. I would not think
>
It sounds like the Watir::RSpec::Helper has not been added to the example
groups.
Did you run the "watir-rspec install" (see last step of installation)? The
install augments your project's spec_helper file to include this module and
other related parts.
In terms of the debugging question, I
lines of output.
> I did not make a copy of the spec_helper before I ran the install.
> What should I look for in there?
>
> thanks!
> -AZ
>
>
> On Tuesday, October 4, 2016 at 6:52:30 AM UTC-7, Justin Ko wrote:
>>
>> It sounds like the Watir::RSpec::Helper has not be
The difference appears to be that `b.link(:text, 'Recharge')` includes
hidden links, where as `driver.find_element(:link, 'Recharge')` only
includes visible links.
The page includes 8 links with the matching text:
Recharge
Recharge
https://www.airtel.in/netbanking/payments-recharges;
w.getComputedStyle(arguments[0]).backgroundColor;', control)
For this specific example, you can simply this further by using Watir's
built-in `style` method instead:
control.style('background-color')
- Justin Ko
On Tuesday, July 4, 2017 at 11:41:33 AM UTC-4, AROCKIA JERALD wrote:
>
> Hi all,
&
How did you define `@b`?
Based on the exception and behaviours you are seeing, it sounds like you've
created a Selenium::WebDriver instead of a Watir::Browser. The
initialization should be like:
@b = Watir::Browser.new
- Justin
On Wednesday, November 29, 2017 at 3:45:21 PM UTC-5, Jeff Fagot
Rajagopalan, would you be able to see if the changes I have made in
https://github.com/jkotests/watir/tree/simplify_locator fixes the
performance problem for :visible_text?
I think the problem is where we filter elements:
def filter_elements_by_locator(elements, visible = nil, visible_text =
...@gmail.com
wrote:
>
> This change available in recent water 6.10.1?
>
> On Tuesday, December 12, 2017 at 11:39:51 PM UTC+5:30, Justin Ko wrote:
>>
>> Rajagopalan, would you be able to see if the changes I have made in
>> https://github.com/jkotests/wat
Yes, the plan is to remove :link, :link_text and :partial_link_text.
It is known that using :visible_text will not have the same performance. It
has to iterate over elements, where as the Selenium ones would not. The
benefit of :visible_text is that we can apply it across all element types,
Do you try using the :id locator? It looks like you might have crossed your
attributes/values - ie the attempts are checking the "fielddisplayname"
attribute, but looking for the id value.
Try:
@browser.a(id: "Employee_ID").click
If #click isn't working, you could also try #click!
click, it is
> not choosing as selenium click towards the option would choose the option .
> But button click remain the same for both, do know why it is ?
>
> On 23-Jun-2018 1:06 AM, "Justin Ko" >
> wrote:
>
> Do you try using the :id locator? It looks like y
:link and :link_text are Selenium-WebDriver locators. Their support is
quite limited in Watir. They are only accepted when using the #element
method:
browser.element(link_text: "Services").exists?
#=> true
browser.element(link: "Services").exists?
#=> true
Instead, I would suggest using
>
> If you try to use something like browser.link(text: "Services").click, it
> says:
>
> "element located, but timed out after 30, seconds."
>
The problem here is that there are actually 2 services links on the page.
One is in the mobile nav menu (when the browser width is small) and one is
;>>
>>>>>>> On Tuesday, August 7, 2018 at 9:54:17 PM UTC+5:30, Titus Fortner
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> jquery_wait = lambda { |br| br.wait_until { |b|
>>>>>>>> b.execute_script
The #wait_for_ajax simplifies things if you need to manually call it.
However, it sounds like you would have to sprinkle this everywhere.
I would suggest adding the jQuery.active check to your browser's
after_hooks. Ideally this would catch all (or at least most) of the
problems.
Note that
Hi Navi,
Just to be clear, are you saying that "Watir::Wait.until(timeout: 30) {
@browser.execute_script('return jQuery.active == 0')}" solves the timing
issue? You are just asking if there is a Page Object way to avoid doing
this manually everywhere?
Thanks,
Justin
On Tuesday, August 7,
In that example, you should just #add_to_bag.
I'm guessing that you are working with a code base that is older than Watir
6.0. Before v6.0, add_to_bag_element.when_present.click was required for
elements that were not immediately present on page load (ie you needed to
wait for them to appear).
Hi,
Accessing the spans within minimum_spend_threshold_error would be similar
to what you did with nav_div_elements:
page.minimum_spend_threshold_error_element.span_elements[0].html
#=> ""
page.minimum_spend_threshold_error_element.span_elements[1].html
#=> "Sorry, your Perks Payday Voucher
The accessors do not provide a mechanism for filtering the element
collection. In other words, the exception is from
`product_line_items_in_bag_elements(:"data-product-id" => '9350486827327')`.
You can filter the elements manually using `#find`:
class MyPage
include PageObject
>
> 1. Just like we do plural for div, I mean divs, isnt there plural version
> for select_list i:e select_lists? Similarly buttons?
> How do we know if there is a plural version at all. I couldn't find
> the documentation.
>
The plural version `#select_lists` does exist. I don't think
>
> The question regarding Chrom is still valid. Can anyone drive the chrome
> and goto an url on win 10?
>
Chrome works for me on Windows 10 Pro using:
- Watir 6.11
- Selenium-WebDriver 3.13
- Chrome 67
- Chromedriver 2.4
Justin
--
--
Before posting, please read
>From the logs, I see:
1. A "Checking this box will delete any prior coverages" alert is
accepted
2. The NavContinue button is retrieved (elementID:
04743404-40e9-4dc0-bae8-1f3e270f3eae)
3. Several clicks are attempted, but intercepted by
4. Several clicks are attempted, but
Any chance you can capture a video of the test? It's hard to reconcile this
discussion and logs without seeing anything.
Justin
On Tuesday, November 6, 2018 at 12:37:01 PM UTC-5, rajagopalan madasami
wrote:
>
> I am calling this function
>
> def waitForPageLoad
>
> @b.wait_until(timeout:
Hi Navi,
I would expect the closing situation to be much simpler. You should be able
to just check that the element is no longer present:
slide_dialog = browser.div(id: 'slide-dialog-container')
slide_dialog.wait_while(&:present?)
The overflow was only important in the expanding case as it
Navi,
In the video of the problem, you can actually see the overflow style change
while the section is sliding.
You can also see it change using the following Watir code:
browser.link(text: 'Sign in here').click
slide_dialog = browser.div(id: 'slide-dialog-container')
150.times { puts
(id: 'slide-dialog-container').wait_until do |s|
s.present? &&
s.style('overflow') == 'visible'
end
continue_as_guest_element.click
end
Justin
On Tuesday, September 25, 2018 at 2:42:02 PM UTC-4, Justin Ko wrote:
>
> Element#height didn't work for me. It was returning hei
Hi Navi,
How is #delete_coupon_elements defined? I would have expected it to
re-determine the collection each time it was called.
Titus made some fixes around collections in 6.13 and 6.14. You could see if
that resolves your issue.
I suppose it could be a timing issue - eg :
1. The first
Hi Navi,
Selenium only screenshots the content in the viewport. If you want the
whole browser, you would need to take multiple screenshots.
There was a gem recently released to do this -
https://github.com/samnissen/watir-screenshot-stitch
Though I haven't tried it myself.
Justin
On
Sounds like the timing issue. Maybe try waiting for the coupon to be
removed before continuing:
delete_coupon_elements.find{|el| el.value.to_s == coupon_id.to_s}.tap(&:
click).wait_while(&:present?)
Justin
On Thursday, September 20, 2018 at 9:30:17 AM UTC-4, NaviHan wrote:
>
> Hi Justin
>
>
It looks like the button itself isn't sliding. The div that contains it is
actually increasing in height. So my previous suggestions about waiting for
the button to stop moving doesn't work.
I'm still not quite clear on how the click is getting intercepted. However,
waiting for the section
(Sorry, if some of this repeats Titus's response. I was half way through
this when he replied.)
If I'm envisioning the sliding correctly, I believe what happens is:
1. The button starts sliding on to the page (at which point it'll be
considered present)
2. The coordinates of the button are
Element#height didn't work for me. It was returning height of the div
including the part cut-off by the overflow. The clientHeight gave the
height excluding the cut-off portion.
Justin
On Tuesday, September 25, 2018 at 2:33:06 PM UTC-4, Titus Fortner wrote:
>
> Also, Watir has a
n you look into that
> ?
>
> On Wed 19 Dec, 2018, 9:43 PM Titus Fortner wrote:
>
>> Our specs are all passing, so you need to provide a reproducible issue
>> so we can add the use case to our test suite.
>>
>> On Wed, Dec 19, 2018 at 8:50 AM Justin Ko > >
Instead of working from the the "gc-list", you could work from the
"gift-cards-list". It would save a level of nesting and eliminate the child
vs descendant difference:
# Page-Object
divs(:applied_gift_card, :class => 'gift-cards-list')
# Usage
p
Hi Navi,
One element still counts as a collection, so it should work. What error did
you get?
Justin
On Saturday, November 24, 2018 at 12:52:22 AM UTC-5, NaviHan wrote:
>
> Hi Justin
>
> The collection was the first thing I tried. But the issue is when there is
> only one gift card applied,
Hi Navi,
I don't think you'll be able to directly call Page-Object's #wait_for_ajax
from an after hook. You'll have to do the wait directly.
I believe you said you were using jQuery. Where you are initializing the
browser, add the following line to add the after_hook:
browser =
Can you elaborate on what is not working?
I get the same behaviour in 6.14 and 6.16 when running the below script -
ie `browser.select_list.select` does not select anything.
gem 'watir', '=6.14'
require 'watir'
browser = Watir::Browser.new
browser.goto 'test_page.html'
If there are no matching elements, you should get an empty Array:
p page.products_on_wishlist_elements.class
#=> Array
p page.products_on_wishlist_elements
#=> []
Justin
On Wednesday, March 27, 2019 at 8:18:45 AM UTC-4, NaviHan wrote:
>
> Hi Titus
>
> I read a wondeful article about the
all")
> span(:remove_all_link){ wishlist_remove_all_element.span }
>
> Justin is there an easier way to do this in PO gem?
>
>
>
>
>
> On Tuesday, March 26, 2019 at 11:39:39 AM UTC-5, Justin Ko wrote:
>>
>> In most cases, it is simply a matter of personal pref
In most cases, it is simply a matter of personal preference. There is
usually no technical difference between between using CSS/XPath vs
attributes. To me, the most important thing is to be consistent as an
organization so that code is consistent, which makes the code easier to
read/maintain.
There is nothing directly provided for working with the ActionBuilder. If
you need to call the ActionBuilder, you will need to access the
Selenium::WebDriver and convert the Watir::Element using #wd - eg:
browser.driver.action.click(your_watir_element.wd).perform
Note that there are methods
Sorry Navi, I'm not too familiar with the inner workings of Cucumber. I
abandoned it long ago for RSpec. While people on this mailing list can
likely help with how to use Cucumber, understanding the internal workings
is likely better suited in Cucumber's mailing list (or whatever they use).
> click?
>
> On Wed, 3 Apr, 2019, 9:45 PM Justin Ko, >
> wrote:
>
>> There is nothing directly provided for working with the ActionBuilder. If
>> you need to call the ActionBuilder, you will need to access the
>> Selenium::WebDriver and conv
Yes, that would work.
Personally, I find "falsey" hard to type. Technically it also includes
"nil", though #present? shouldn't return that. I tend to go with:
expect(on(MyAccountPage).reward_history?).to eq false
The monkey patch is redefining the method. It's one of those good and bad
Hi,
1. The monkey patch is redefining the method. Last definition wins. It is
how Ruby is designed, nothing specific to Page-Object. A simpler isolated
example:
def a
'hi'
end
def a
'bye'
end
puts a
#=> "bye"
Notice that you can define the method twice, but when called, the last
You are correct that #reward_history? calls #exists?. There is no
auto-generated method for #present?.
It is rather unfortunate. Checking presence is probably more common than
checking existence. As a backwards incompatible change, it'll take some
time to change.
If you want, you could
Hi Navi,
At this point, I would say there is a design flaw in Page-Object's #alert
method, which does:
if @browser.alert.exists?
value = @browser.alert.text
@browser.alert.ok
end
The conditional check is likely the cause of your problem. I don't know the
history of how we got here, but my
Page-Object introduces its own couple of waits
(https://github.com/cheezy/page-object/blob/master/lib/page-object.rb#L87-L113):
- default_page_wait which has a default of 30 and
- default_element_wait which has a default of 5
The default_element_wait will impact the Element methods
Hi Navi,
1) It would depend on who is calling the method - ie a Watir::Element vs a
PageObject::Element. Generally you would be working with
PageObject::Element, so you would be calling the Page-Object version. The
recent versions of Page-Object forward missing methods directly to the
Watir
el[@title='Subject']/following-sibling::div/lf-select/div/span").click
>>>
>>>
>>> I have tried this
>>>
>>> b.label(title: 'Subject').following_sibling.element(tag_name:
>>> 'lf-select').div.span.click
>>>
>>> B
For custom elements, you will need to use the #element method:
b.element(tag_name: 'lf-select')
Justin
On Tuesday, May 28, 2019 at 1:15:05 AM UTC-4, rajagopalan madasami wrote:
>
> Hi,
>
> I have a custom tag named `lf-select`
>
> Can't I call in WATIR like
>
> b.lf_select()
>
> Or something
There is an :element locator that takes the Selenium object:
element = driver.find_element(id: 'something')
watir_element = browser.element(element: element)
Justin
On Thursday, June 20, 2019 at 3:28:45 AM UTC-4, rajagopalan madasami wrote:
>
> I know how to convert WATIR element into selenium
It does not look like Selenium-WebDriver provides a mechanism for ignoring
specific deprecations. You will have to monkey-patch the error away:
require 'selenium-webdriver'
module Selenium
module WebDriver
module Error # rubocop:disable Metrics/ModuleLength
def
The --window-position arguments should be without a space - eg:
args = ['--window-position=-3000,0']
browser = Watir::Browser.new :chrome, options: {args: args}
Note that this is just positioning it off-screen; not actually minimizing.
Justin
On Wednesday, April 10, 2019 at 12:33:41 PM UTC-4,
Manually (ie as a person, not automated by Watir) doing the steps, I am
able to reproduce the problem. It happened frequently in Firefox, but could
also be seen occasionally in Chrome. As the problem can be seen manually,
this does not seem to be a Geckodriver, Watir or Selenium problem.
To
Hi Andrei,
Do you have an example of where an OR evaluation is useful?
As Titus said, it's not usually the way to go. That said, I'm pretty sure
I've done it before. The solution usually depends on what you are trying to
do and the page. For example:
- If you wanted to match elements with
I cannot think of why the collection would change automatically, but here
are some things that might help debug the issue:
1. Share the webdriver logs for the scenario (enable using
Selenium::WebDriver.logger.level = :info)
2. Is "errors" a custom method or variable? The smalls
Titus released v6.17.0 last night.
Watir still has active support. This mailing list, Stack Overflow and Slack
usually get a response. Active development will vary based on how much free
time the developers have - eg this past year has been pretty bad. If
there's something you need, feel free
80 matches
Mail list logo