[wtr-general] Re: Privacy Policy

2019-07-19 Thread Chuck van der Linden
WATIR is a code library, not a website or online service.. it doesn't have 
a privacy policy.  There's nothing to keep private, you don't log in, you 
don't have an account, you don't share personal info with the library or 
even the watir.com website.  

  The closest you get to that kind of document might be the license 
agreement

The 

On Friday, July 19, 2019 at 9:35:25 AM UTC-7, Martin Sütterlin wrote:
>
> Hey all together,
>
> at the moment I am doing some research for a test automatisation tool. 
> Watir seems very interessting for my project. Does anyone of you know 
> something about the privacy policy of Watir or a link where I can find 
> something out about that?
>
> Thank you in advance!
> Martin
>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
In short: search before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/watir-general/e676828b-a343-4097-9c50-0b2aa0d99da4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Click succeeds but action as the result of that click is not triggered

2019-07-19 Thread Chuck van der Linden

On Sunday, June 16, 2019 at 5:47:51 AM UTC-7, rajagopalan madasami wrote:
>
> Hi Titus,
>
> I have raised this issue in Geckodriver, but I want to ask you whether 
> this kind of problem can be resolved from programming level in WATIR
>
> Here is the link
>
> https://github.com/mozilla/geckodriver/issues/1573
>

Looks like a geckodriver issue alright, especially if it works fine in 
chrome.

I've sometimes been able to work around this by digging into the code on 
the browser side to see if there's a specific event it's looking for and 
then firing that event against the element

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
In short: search before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/watir-general/a9b2859b-cc3b-4559-a095-231b0893942c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: How to write and regular expression in WATIR?

2019-07-19 Thread Chuck van der Linden

On Saturday, June 22, 2019 at 9:52:28 AM UTC-7, rajagopalan madasami wrote:
>
> Consider the below code
>
> b.element(name: /hello|username/).send_keys 'testid'
>
>
> `/hello|username/` represents the or operator, that means it searches the 
> name which is hello or username, how do I write regular expression which 
> search for hello and username?
>
>
Well it's ruby code, so you use standard ruby regular expressions.   is 
what you've got above not working?   Normally I'd not use the generic 
'element' but the more specific type such as .input

Can you share a sample of the HTML you are trying to interact with? 

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
In short: search before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/watir-general/029858d6-2baf-43ae-a4a5-3a5f06cb356f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: visible_text is deprecated

2017-12-14 Thread Chuck van der Linden

On Wednesday, December 13, 2017 at 10:23:58 AM UTC-8, 
rajagopalanmadas...@gmail.com wrote:
>
> It's not possible to locate element without xpath in some places, xpath is 
> pretty important and also unlike watir-classic, new WATIR which uses 
> selenium-webdriver does the exceptional job with xpath. I have written an 
> xpath when I code yesterday for an insurance company
>
> @b.element(xpath: 
> ".//*[@id='ApprovalManagerSearch']/following-sibling::div[1]").iframe(id: 
> 'SearchPanel').element(:id, "adviser1").click
>
> You see, you can't locate this element without using xpath and ofcourse watir 
> provides functions to form this xpath, but that's for beginners, not for the 
> one who learnt very well. 
>
>
Interesting example.  Why won't the following work?

#(replace  with the method for the type of element you want to 
click on, e.g. .span or .div, etc) 
b.iframe(id: 'SearchPanel').(:id, "adviser1").click 


If the site is coded to meet the HTML standard 
 then ID values are 
unique within what most of us call a 'page' (technically it's the element's 
home 
subtree )  
 So you should be able to directly access the iframe by ID, instead of 
having to worry about the outer container.  Of course iframes effectively 
have their own unique home-subtree so you do of course have to specify the 
iframe, then the thing you want that is inside a subframe  (Yes, I know YOU 
already know about iframes. Consider that last sentence for the benefit of 
other readers.)

Now, if the site isn't coded with valid HTML and ID values are not unique, 
then I can see the need for the outer container.Although I would take 
issue with the statement that XML is the *only* way to select that as CSS 
selectors also allow you to select adjacent siblings, as does the 
.following_siblings watir method.  So claiming xpath is the only way is a 
falsehood.

(ah, see I was somewhat ninja'd by Titus)

Now if the site was created by developers who don't care if they code to 
standards, then I would still argue that watir code such as that below is 
easier to follow, and update when needed than a giant xpath selector 
(making up the html tag types as I don't have actual html to reference)  

@b.div(id: 'ApprovalManagerSearch')
  .following_siblings[1]
  .iframe(id: 'SearchPanel')
  .span(:id, "adviser1").click


If this is a site you are testing, and it does not conform to the HTML 
specification, I would file bugs against those spec violations.  There 
really is no excuse for any developer to be producing a site with invalid 
HTML and counting on the relative *tolerance and forgiveness of the browser* to 
deal with their shitty HTML.  If they can't make the ID's unique then I'd 
lobby to remove them and include some custom attribute (data-*something* most 
likely) so you can select the one you want without having to rely on an 
index as in my experience that's the most likely thing to be brittle and 
break when the design of the site is altered.  That would perhaps return 
the sites code to compliance with the spec and also increase the 
testability of the site. 

If it's a 3rd party site you have no control over, and presuming you are 
not violating any terms of service regarding accessing the site via the use 
of robots or automation, then sadly you just have to cope with the garbage 
being produced by their developers.  Although frankly in that case I'd be 
asking about an API as that is generally a superior way to interact with a 
3rd party platform.  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: visible_text is deprecated

2017-12-13 Thread Chuck van der Linden
On Tuesday, December 12, 2017 at 9:56:46 AM UTC-8, rajagopalan madasami 
wrote:
>
> I am using watir over selenium for two reasons, one reason is waiting 
> timings are maintained by local language binding but selenium is 
> maintaining timing from driver level , since selenium uses the timing from 
> driver level it differs from Firefox to Chrome, but since WATIR is 
> maintaining timing from local language binding it doesn't matter whether I 
> use Chrome or Firefox. Another reason is stale element problem, WATIR 
> relocates the element when element  goes to stale other than that I don't 
> use any other features of WATIR because everything else is time consuming 
> like xpah formation. So if you simply allow element () to access selenium 
> locators directly it would be useful for me rather than unnecessary 
> deprecating what word extraordinary.
>
>>
>>  When you say *xpath formation*, are you referring to figuring out xpath 
to use for selecting elements, or something internal to the code?

I'm a bit surprised if the first as I almost never use xpath, in fact I 
avoid it, when selecting elements,  I'm nearly always using something like 
ID, or Name, or Data-something, or Class , or increasingly of late CSS 
selectors (whatever allows me to uniquely locate the element(s) I need).  
For me the main objective is clear readable code which is as non-brittle as 
possible.   So for something like the makemytrip site I'd be selecting 
things such as 

browser.text_field(id: "hp-widget__sTo")


 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: visible_text is deprecated

2017-12-12 Thread Chuck van der Linden
bah... need to be able to edit... I confused using .link method of watir 
with the :link locator type of Selenium... please disregard the confusion 
over that sentence.

Point being however that you seem wedded to directly using .element and 
selenium selection methods, so the question of why even use Watir as 
opposed to Selenium, given your preferences, still exists. 

On Tuesday, December 12, 2017 at 9:17:10 AM UTC-8, Chuck van der Linden 
wrote:
>
>
>
> On Monday, December 11, 2017 at 10:29:52 PM UTC-8, 
> rajagopalanmadas...@gmail.com wrote:
>>
>> Can you please pay a little attention to the ongoing conversation? The 
>> conversation is not about using element() or using link() function, the 
>> conversation is about performance issue while I use visible text. I am 
>> ready to use visible text If it does the good performance but it's not 
>> doing it, I am trying to click a link which takes minutes to click that 
>> link but when I use link locator it clicks instantly. 
>>
>
>  You say that, yet every code example I see from you uses .element
>
> Then we have statements like this:
>
>>  Yes, I agree using b.link() increases the performance, But I completely 
>> against the idea of not using the link: locator of selenium.
>
>
> (given the sentence makes no sense if parsed using the double negative (in 
> which case you would already be using .link, which you are not),  I presume 
> that 'not' in the above is a typo) 
>
> So despite people telling you to use .link, you seem insistent on using 
> .element.  which is basically the same as using raw Webdriver instead of 
> Watir.  So frankly I don't think my question is that out of line.  If you 
> insist on using .element, and are as you stated 'completely against the 
> idea' of using the watir API, then why use Watir and not just use webdriver 
> directly?
>
> In terms of performance: 
> As Titus asked earlier, can you provide a code example that demonstrates 
> the performance difference you are claiming to see?  not a discussion of 
> code, but actual code against an actual site. 
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: visible_text is deprecated

2017-12-12 Thread Chuck van der Linden


On Monday, December 11, 2017 at 10:29:52 PM UTC-8, 
rajagopalanmadas...@gmail.com wrote:
>
> Can you please pay a little attention to the ongoing conversation? The 
> conversation is not about using element() or using link() function, the 
> conversation is about performance issue while I use visible text. I am 
> ready to use visible text If it does the good performance but it's not 
> doing it, I am trying to click a link which takes minutes to click that 
> link but when I use link locator it clicks instantly. 
>

 You say that, yet every code example I see from you uses .element

Then we have statements like this:

>  Yes, I agree using b.link() increases the performance, But I completely 
> against the idea of not using the link: locator of selenium.


(given the sentence makes no sense if parsed using the double negative (in 
which case you would already be using .link, which you are not),  I presume 
that 'not' in the above is a typo) 

So despite people telling you to use .link, you seem insistent on using 
.element.  which is basically the same as using raw Webdriver instead of 
Watir.  So frankly I don't think my question is that out of line.  If you 
insist on using .element, and are as you stated 'completely against the 
idea' of using the watir API, then why use Watir and not just use webdriver 
directly?

In terms of performance: 
As Titus asked earlier, can you provide a code example that demonstrates 
the performance difference you are claiming to see?  not a discussion of 
code, but actual code against an actual site. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-11 Thread Chuck van der Linden

On Monday, December 11, 2017 at 1:15:38 AM UTC-8, 江南 wrote:
>
> Thanks for all your information they are very helpful. 
>
> I do understand the concept of Cucumber.  
>
> I'm working directly with a Developer, I personally have not come up with 
> this idea but my Developer has asked me about writing the script this way 
> and I have explained to him about Page Object but I also want to get an 
> outside opinion just to be a supporting evidence that this is not the way 
> to use Cucumber. 
>
>
So if you are using Feature files as a way to gain understanding of what 
the product should do, and working with a developer (and hopefuly PO)  to 
create and review feature files, then it sounds like you have at least one 
other person on the team that knows about BDD and why you want to use tools 
like Cucumber.  As long as some collaboration benefit is accruing, then I 
would say proceed with Cucumber.   If you are the only person that ever 
looks at a feature file, then there is little benefit to using Cucumber 
over something like Rspec.  (FYI if you and the developer like the idea of 
using cucumber, but the PO is hesitant, I'd suggest you see if you can get 
them to have a look at the book 'Specification By Example"   The first two 
chapters can be downloaded from the publisher for free, and do a good job 
of laying out the benefits of this approach.  

The 'Page Objects' Pattern is not an alternative to Cucumber, nor something 
to use instead of Cucumber.   Page Objects is an abstraction layer to make 
it easier to maintain the identifiers of webpage elements in test code that 
is testing a Web UI.  The idea is that if a developer does something like 
change the UI such that you need to update identifiers, that you just have 
to do that in one single place, instead of updating 50 scripts or step 
files.  You can use Page Objects in just about any testing framework, be it 
inside the steps of cucumber tests, or inside test methods in Rspec or 
another testing library.   

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: visible_text is deprecated

2017-12-11 Thread Chuck van der Linden
On Sunday, December 10, 2017 at 9:03:18 AM UTC-8, rajagopalan madasami 
wrote:
>
> 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, 
> not just links.
>
> Yes, it is increasing the performance ! But still it's taking much time 
> but compared to element() function it's okay. But *link*: locator really 
> rocks! I still don't have any clue why WATIR is going to forbid using such 
> a powerful performance of Selenium, I don't see any reason other than 
> putting just name sake of WATIR API. 
>
> I have a number of ideas for improving locator performance in general. 
> However, for this specific case, you will see performance improvements by 
> not using #element. Just switching to using #link will cut down the 
> number of elements Watir has to iterate over. If there are other locators 
> to reduce the links checked, that will also help performance. If that 
> doesn't help, a specific example would help us identify other places for 
> performance improvements.
>
> Yes, I agree using b.link() increases the performance, But I completely 
> against the idea of not using the link: locator of selenium.
>
> If I pass the locator which is inside the selenium locators list, then 
> make a direct call to find_element just by passing those two values, but 
> when you find the locator which is not in selenium locators list, then go 
> for formation of xpath. It's pretty simple. It was good but I don't know 
> why all these unnecessary arrangement which actually spoils the WATIR 
> structure rather than improving. The very first time yesterday when I 
> developed  WATIR code for new project, I installed previous version(6.8.4) 
> because of this new arrangement. 
>
>
If you want to just use `.element` method instead of specific element type 
methods such as `.link` , and use selenium locators instead of those that 
Watir provides, then why use Watir?  Why not just use raw Webdriver 
instead, since you see to like its API more than the Watir API?   The only 
time I use .element with Watir is as a last resort when nothing else will 
work.  Otherwise I use the selection methods that parallel the DOM element 
type I am selecting, be it a .div or a .link or a .checkbox

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-08 Thread Chuck van der Linden
one other thing (see below

On Friday, December 8, 2017 at 1:54:15 AM UTC-8, 江南 wrote:
>
> Thanks for your suggestion. 
>
> I'm testing a website and I have various data to test but I don't want to 
> create duplicate steps in different feature files so I want to do is put 
> the test steps e.g. Login page in one feature file and Account page in 
> another then pull the input data from a spreadsheet. 
> I think this way will make easier to maintain the feature file that is 
> all.
>
> Dangit, hit send too quickly on prior response.  I also meant to add this 
regarding spreadsheet use with cucumber.

If you are working with cucumber but want to pull in data from a 
spreadsheet, that is most often a sign that cucumber may not be the right 
tool for you.When using cucumber your test data should be defined in 
the feature files.   There are a number of ways that cucumber supports 
this, from steps that can take a table to process, to using scenario 
outlines where the scenario is defined with replaceable parameters that are 
pulled from a table of 'examples'  and the scenario is repeated for each 
row in the table. 

Putting test data in a spreadsheet obscures it from view, making it harder 
to understand what tests are doing when reading feature files, which 
defeats the main purpose (common understanding) of using feature files in 
the first place.   If 'it doesn't matter because nobody else reads the 
feature files' then you should not be using cucumber, use instead rspec and 
just code the test steps directly in code, not in a feature file.  Then if 
you want to have data files in spreadsheets, you can just make use of some 
of the common gems for reading and writing common spreadsheet format files. 

Cucumber is a great tool, but it is also primarily a collaboration tool, 
not a test tool.  Yes testing is a part of what cucumber does, but that is 
not its primary purpose.  Suggested 
reading: 
https://cucumber.io/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-08 Thread Chuck van der Linden
On Friday, December 8, 2017 at 1:54:15 AM UTC-8, 江南 wrote:
>
> Thanks for your suggestion. 
>
> I'm testing a website and I have various data to test but I don't want to 
> create duplicate steps in different feature files so I want to do is put 
> the test steps e.g. Login page in one feature file and Account page in 
> another then pull the input data from a spreadsheet. 
> I think this way will make easier to maintain the feature file that is 
> all.
>
>
While well intentioned you are heading in a direction that doesn't work 
very well..  Also your question seems to tell me you don't understand the 
basic concepts of how cucumber works (or you are not good at expressing 
your understanding) 

By design, steps are re-usable  so it is completely normal to see the same 
steps used in multiple feature files.
By design, there is only a single definition for a given step.. you can't 
have two steps with the same phrasing such as "When I login as " that 
do different things, that will result in an error.
Feature files should be created in a way that documents and describes the 
operation of the product.  Think of it like portions of a book that tells 
what your product does.
Step files, where steps are defined do not have to (and usually should not) 
parallel your feature files.   Rather the most common thing is to group 
common steps together.  For example a login_steps.rb file might have steps 
to login, self-register a new user, logout, etc.   You might have another 
step file that deals with steps that navigate around your site "when I 
click the xxx tab" for example

For anyone new to Cucumber I strongly recommend reading "the Cucumber 
Book"   it's the best way to gain an understanding of what cucumber is for, 
and how to best use it most effectively. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Chrome Headless Browser

2017-12-08 Thread Chuck van der Linden

On Friday, December 8, 2017 at 9:14:42 AM UTC-8, 江南 wrote:
>
> Hi,
>
> I have tried the code below but my script just keep loading then I get 
> this message: Net::ReadTimeout: Net::ReadTimeout
>
> @browser = Watir::Browser.new :chrome, headless: true
> @browser.goto "www.google.com"
>
>  Can someone tell me am I missing something?
>
>
> Thanks
>
>
Do you have the latest chromedriver installed in a directory that is 
included in your PATH?   (from a command line in any directory on your 
system you should be able to type "chromedriver,exe -v" and it will display 
the version of chromedriver.. (also verifies it can be found on the path)  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Browser instance not recognized by other modules

2017-12-08 Thread Chuck van der Linden
On Thursday, December 7, 2017 at 12:19:51 PM UTC-8, Jeff Fagot wrote:
>
>
> So now, I would turn my question in a different angle: why is my Browser 
> instance @b declared in my *** ENVR.RB *** file known to my *** STEPDEF.RB 
> *** file?
> Does it mean that Modules or Class are segregated from the "rest of the 
> world" (== ENVR, STEPDEFS...) and that the "rest of the world" can be seen 
> as a unique big Class?
>
> Thanks for helping me thru the process of sorting things out!
>
> Titus thanks for the advice on BDD, when I started I did not know about 
> RSpec and spec_helper, but I will definitely take your advice !
>
>>

I second what Titus said about BDD..  while you can build a test framework 
from cucumber, if you are not also using it for BDD then you are really not 
getting the full benefit from cucumber, and in a lot of cases you would be 
better off with using rspec as a test framework.  You can create re-usable 
test helper methods that work much the same way as the reusable steps in 
cucumber.   Writing proper tests in gherkin is a bit of an art, and if you 
are not using the feature files to drive shared understanding of what the 
product is supposed to do, then that is mostly just additional overhead, 
and the same test steps could be expressed directly in the code for your 
tests. .

As to why things defined in env.rb are available in steps, (as well as 
things defined in steps usable in other steps), well that's part of the 
magic of the cucumber 'world'.   It's part of the design in order to make 
it easy to pass data between steps, create common objects that are used by 
steps etc.  You can for example make a 'my_account' variable in a given 
step that establishes the account balance, and then later use the same 
variable in another step that modifies the balance with a deposit or 
withdrawal.For more details I would strongly recommend reading 'The 
Cucumber Book", it's the best way I know of to get off to a good start with 
Cucumber and avoid a lot of the more common pitfalls I see testers fall 
into when they first encounter Cucumber. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Browser instance not recognized by other modules

2017-12-08 Thread Chuck van der Linden
On Thursday, December 7, 2017 at 12:19:51 PM UTC-8, Jeff Fagot wrote:
>
> Did not get a chance to dive into creating my first Class but I will do 
> asap.
> I quite understand the concept of the Page Object (I will still need 
> practice to get to the understanding of where exactly should I use it and 
> how) and that is why I was looking into Classes yesterday.
>
> I guess what I am still confused about is what makes the difference?
> To me it looks like by doing so (create class Login) I would only do a 
> translation of my problem to a sub-level.
>  Why would I be able to use more easily (from anywhere) an instance of 
> "Login" than an instance of "Browser"?
>
> I mean, I understand I can use the instance from where it's been 
> instantiated, but how do I use it from elsewhere ?
> (I hope my question makes sense)
>
> Things are starting to make sense as I am typing and trying to even myself 
> understand my problem.
> So now, I would turn my question in a different angle: why is my Browser 
> instance @b declared in my *** ENVR.RB *** file known to my *** STEPDEF.RB 
> *** file?
> Does it mean that Modules or Class are segregated from the "rest of the 
> world" (== ENVR, STEPDEFS...) and that the "rest of the world" can be seen 
> as a unique big Class?
>
> Thanks for helping me thru the process of sorting things out!
>
> Titus thanks for the advice on BDD, when I started I did not know about 
> RSpec and spec_helper, but I will definitely take your advice !
>

Rather than a login class, I would suggest you create what I call a 'Domain 
Object' class, in this case a User class.  You can then put methods like 
Login, Logout, Register, Update_Profile, etc.

What objects to create depends on the nature of the business domain..   In 
a retail setting you might have a shopping cart class, (an instance of 
which could be included in your user class).  When working at one company 
that made a site for farmers I had domain objects (defined as classes) for 
the user, and their fields, etc.  

Have a look at the Test Factory gem  it is a simple approach to both page 
objects and domain objects and is designed to work with watir. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Running 2 cucumber feature file in one web session

2017-12-07 Thread Chuck van der Linden
On Wednesday, December 6, 2017 at 10:19:09 AM UTC-8, Arik Jones wrote:
>
> You could create a browser session in `features/support/env.rb` and assign 
> it to an instance variable
> and then use that session in your feature files. Its basically a global 
> hook, but you'll need to end that session properly with an `at_exit` method.
>
> More info here: 
> https://github.com/cucumber/cucumber/wiki/Hooks#global-hooks
>
> Personally I don't recommend running your features that way.  Can I ask 
> why you need to do it this way?
>
> On Wednesday, December 6, 2017 at 8:32:35 AM UTC-6, 江南 wrote:
>>
>> Hi,
>>
>> I am using Watir Ruby + Cucumber for my testing. 
>>
>> Can you tell me how to run two feature files in one web session?
>>
>> Thanks
>>
>
That's where (in the env.rb file) I normally create the browser object when 
using Cucumber.. 

Performance wise that is highly preferable to creating and destroying a 
browser instance for each scenario, which can add quite a bit of overhead 
to your tests.  You may want a step that clears cookies, or loads a 
standard cookie for tests where that can matter, then include that as 
needed to simulate a 'clean-start' on the browser when required.

Unless you want to type out a really long command line with each feature 
file specified, using Tags is generally the easiest way I have found to 
have cucumber execute multiple scenarios from multiple feature files.  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: Removal of :name attribute from divs and spans

2017-11-22 Thread Chuck van der Linden
On Tuesday, November 21, 2017 at 8:45:45 AM UTC-8, Titus Fortner wrote:
>
> we're actually looking to relax the strict requirements in an upcoming 
> release, so this might not be an issue soon.
>
> On Nov 21, 2017 10:13 AM, "Super Kevy"  wrote:
>
>> Check W3Shools  https://www.w3schools.com/Tags/ref_standardattributes.asp 
>> and https://www.w3schools.com/tags/att_name.asp
>>
>> That attribute is not a default as far as I understand.  
>>
>>
>>>
Part of me worries about supporting HTML that is not within what is 
specified by the RFC's that define the HTML standards.  It seems like a 
'good thing' that we don't support (as an example) the name attribute on a 
element where that attribute is not specified as an attribute of that tag 
type. 

That said, we already see lots of technically invalid HTML, and the 
browsers are all for the most part tolerant of that sort of thing.  For 
example I've lost count of the number of times I've seen duplicated ID 
values within a page, which is technically invalid HTML, but yet you see 
it.So given website devs are gonna do what website devs are gonna do, I 
guess it's not incumbent on us to make life difficult for the people 
testing those sites, by limiting our use of what attributes can be used to 
identify given elements on a page.

Given I don't think any developer is going to modify their bad practices 
just because we stick to the spec, then it's not really like we would be 
actively 'encouraging' the use of technically invalid HTML.   Further, 
given even things like the google homepage yield a ton of validation errors 
, I'm 
starting to think any attempt on our part to enforce strict adherence to 
the HTML spec is just tilting at windmills. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Log file for test results

2017-11-06 Thread Chuck van der Linden
On Saturday, November 4, 2017 at 11:16:43 AM UTC-7, Aqua wrote:
>
> Hi All,
>
> I am new to Watir and Ruby. I am trying to create a Log file to capture 
> log messages to 
> 1. validate successful google search and 
> 2. unsuccessful google search attempt
>
> I am using Eclipse IDE for executing the ruby scripts. Here is the code 
> that I am trying 
>
> require 'watir'
> require 'logger'
>   
>   $log = Logger.new('log.txt')  
>   $browser = Watir::Browser.new :chrome
>   $browser.goto('http://www.google.com')
>   $browser.text_field(:name,'q').set 'Quality Assurance'
>   $browser.button(:name,'btnK').click 
>
>   begin
> assert($browser.pageContainsText("Quality Assurance"))
>   $log.info("Given search text showed up!")
> rescue
> $log.error("Given search text did not show up!")   
>   end
>
> The code was running fine before I added the begin and end blocks. 
> (Also is the log file generated in the Ruby folder by default?)
> Could someone help me out  with this?
> Thanks in advance.
>   
>
> On Tuesday, March 4, 2008 at 10:07:36 PM UTC-8, Prasad wrote:
>>
>> Hi All, 
>>
>>
Please do not play necromancer and raise 9 year old threads from the dead.

The 'logger' gem (from what I can see) appears not to have had any commits 
for a very long time, and is likely not being maintained.   I would 
consider looking at a logging gem that shows signs of more current 
maintenance (and thus by implication, support)The two most likely 
suspects I see are:
  Logging 
  Timber  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: link and link_text not working in Watir 6?

2017-10-25 Thread Chuck van der Linden
On Wednesday, October 25, 2017 at 12:30:36 AM UTC-7, 
rajagopalanmadas...@gmail.com wrote:
>
> Please reject my last mail, I was wrong about b.link(link_text: 
> 'something').click
>
> Read this one, I have explained the advantage of link: over xpath:
> b.element(text: 'something').click
>
>
> It would create the selenium equivalent of 
>
> driver.find_element(xpath: "//*[noramlize-space()='something']").click
>
> It would perfectly work if this xpath matches only one, but there are more 
> and rest of them are hidden it would choose to click the first one, not the 
> one which is visible, but If you write the below code
>
> b.element(link: 'something').click
>
> It would write the selenium equivalent of 
>
> driver.find_element(link: 'something').click
>
>
> it would perfectly choose the visible one by rejecting all the invisible 
> one, 
>
>
> You may say to me that I could achieve the same by passing 'visible: true' 
> as the second parameter, but WATIR does here is, it iterates over all the 
> links before it chooses the visible one. 
>
> So using link: over xpath: has many advantages, That's why I said we need 
> to go for xpath when we can't use any other available locators. 
>
>>

You realize you are effectively trying to 'mansplain' to one of the 
developers of Watir why not to use a majority of the Watir API?   If you 
are just going to use b.element all the time, instead of making use of the 
Watir API and object model, then what is even the point of using Watir?  
why not just use nakid Webdriver?

I'm only a water user and ex 'support sherif', not a committer, so my 
opinion may not hold as much Weight as Titus's, but my approach has always 
been to use the method/object (one begets the other) closest to the HTML 
element type I am dealing with.  So if I am working with a div, I use 
b.div  etc.  I only use b.element as a last resort.   I honestly don't care 
how watir casts my selections and if it's sending xpath to the driver or 
not, I'm happy to use the API as intended as this for me results in the 
cleanest easiest to read code.. That said, I avoid actual xpath in how I 
specify selections, where I prefer to use watir's native selectors, or css 
selectors and only use xpath if nothing else will work.  (because I find 
xpath hard for humans to read, and often brittle if long paths are given)   

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: link and link_text not working in Watir 6?

2017-10-24 Thread Chuck van der Linden
two thumbs up on the below admonishment/advice.  

On Tuesday, October 24, 2017 at 7:52:36 AM UTC-7, Titus Fortner wrote:
>
> If you want to use Watir without its powerful element location API, and 
> use only the element method and only Selenium locators, you are more than 
> welcome to do that.
> But stop telling other users that it's the right way to do it or that it's 
> better, because it isn't.
>
> Watir provides an easy way for the user to combine multiple location 
> strategies to uniquely identify an element without needing to use XPath.
> What Watir sends to the driver is irrelevant to the user.
>
> XPath for the user => Bad
> XPath for the driver => Good
>
> Separating what the user knows and what the driver knows is the whole 
> point, and your comments are only confusing the issue.
>
>
>
> On Tuesday, October 24, 2017 at 4:39:48 AM UTC-5, rajagopal...@gmail.com 
> wrote:
>>
>> yes, that's what I am saying xpath usage must be the last one. If we 
>> could use available selenium-webdriver locators then we need to prefer that 
>> one. 
>>
>> On Monday, October 23, 2017 at 7:28:06 PM UTC+5:30, Titus Fortner wrote:
>>>
>>> The only reasons not to use xpath are that it is hard to read, and 
>>> difficult to write such that it is not brittle. Neither of these apply to 
>>> how Watir implements its location system.
>>
>>
>>>
>>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: How to not overwrite current html report?

2017-10-18 Thread Chuck van der Linden
On Wednesday, October 18, 2017 at 8:27:57 AM UTC-7, 江南 wrote:
>
> Hi,
>
> I am using Watir Ruby and in my cucumber.yml file I have this line of code 
> to produce the report:
>
> default: --no-source --color --format pretty --format html --out results.html
>
>
>
> But this code overwrites the existing report. How do I generate a new report 
> each time? 
>
>
> Thanks
>
>
This is really more of a question for the Cucumber folks.

They might have a better idea, but one option would be to use a 
shell-script or batch-file that runs the tests and then renames the output 
file when it is done 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: How to identify the index of an element by text

2016-07-20 Thread Chuck van der Linden
On Tuesday, July 19, 2016 at 6:44:36 PM UTC-7, Titus Fortner wrote:
>
> The pattern that I'm assuming Soori is asking about is one I often use for 
> lists. Say I have a list of addresses and I want to delete one.
>
> I'll do something like this:
>
> def delete_address(address)
>   index = browser.div(id: "address_section").divs(class: 
> "address_item").find_index do |div|
> address == construct_address(div)
>   end 
>   browser.div(id: "address_section").button(text: "Delete", index: 
> index).click
> end
>
> (where construct address builds an object from what is on the page in a 
> way that can be compared to the parameter we have)
>
>
> ah yeah I've had to deal with similar.. usually it depends on the HTML 
structure what I do.  Often it's just as easy to find the table-row, or 
container with the identifier, and use .parent.button(text: 
"Delete").click.  When that's the case I usually find I like that better. 
 but sometimes the structure doesn't allow for easy use of parent or 
containers because the items and the associated delete button/link don't 
share a common container.. so yeah in that case the index trick is a good 
way to go.  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: Passing value to is not working

2016-07-19 Thread Chuck van der Linden
On Friday, June 10, 2016 at 9:51:07 AM UTC-7, sivam wrote:
>
> How to set native events false on IE using watir. This could be one of the 
> reason.
> On Jun 9, 2016 4:13 PM, "Mathusudhanan R"  wrote:
>
> I tried placing first line "click event" on do while loop with some 
> minimum interval on checking whether td becomes editable or not. But it 
> didn't happen. I tried with fire events with onmouse down, up, double click 
> on td. But that also didn't help.
> On Jun 9, 2016 4:09 PM, "Super Kevy"  
> wrote:
>
>> What type of error message are you receiving when the script runs?   You 
>> may just need a sleep statement between the td click and text_field set.  
>>
>>
>> On Thursday, June 9, 2016 at 2:46:35 PM UTC-5, sivam wrote:
>>>
>>> After I enter value to the td manually, I can read the value using the 
>>> same code. So there are no issues with index. I can reach to the table 
>>> using that code. Even if I click manually on the td, the text box inside td 
>>> is appearing and I can successfully run the second line alone and I can 
>>> pass. The problem here is I am not able to trigger the click event on td. 
>>> The table has been created on the page as editable html using javascipt. 
>>> When we click on table cell, that cell becomes editable.
>>> On Jun 9, 2016 1:23 PM, "Super Kevy"  
>>> wrote:
>>>
>>> Looks like your table ID is not a string.  You may have meant to use 
>>> index.
>>> Your index may be zero based, I don't recall what 1.8.6 used.
>>> If you can use chrome's inspector (or your browsers inspector) to help 
>>> figure out IDs and Names of elements it makes life easier.
>>>
>>> Check table within http://relevantcodes.com/watir-webdriver-cheat-sheet/
>>>  
>>>
>>> When in doubt use .exists?  to confirm an element is there.
>>>
>>>
>>> puts $ie.frame(:index=>1).exists?   # We expect to see true
>>> puts $ie.frame(:index=>1).table(:id=>'1').exists?# We expect to see 
>>> true 
>>> # Using pure index
>>> $ie.frame(:index=>1).table(:index=>1)[1][1].click
>>> sleep 2   # Give it time to display!!!  Wait_until_present is not a 
>>> feature in 1.8.6
>>> $ie.frame(:index=> 1).table(:index => 1)[1][1].click  #Click the table 
>>> cell 
>>> $ie.frame(:index=> 1).table(:index 
>>> => 1)[1][1].text_field(:class=>"form-ctrl",:id=>"I'd").click
>>> $ie.frame(:index=> 1).table(:index 
>>> => 1)[1][1].text_field(:class=>"form-ctrl",:id=>"I'd").set('hello')
>>>
>>>
>>>

Can you post the portion of the HTML from the page where you are trying to 
click the table cell, potentially there is an element inside the cell that 
needs to be clicked, not the cell itself. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: cannot load such file — Config/Data/data_form.yml (LoadError)

2016-07-19 Thread Chuck van der Linden
On Monday, July 11, 2016 at 8:31:30 AM UTC-7, Ajay Reddy wrote:
>
> Hi All,
>
> I am getting this "cannot load such file — Config/Data/data_form.yml 
> (LoadError)", I need your help to fix this issuse.
>
>
> require "./TestData"
> require 'yaml'class CardSubmission < Application
>   include PageObject
>   include DataMagic
>   include TestData
>
>   def initialize(browser)
> @browser = browser
>   end
>
>   def submit_application(data = {})
> DataMagic.load ("data_form.yml")
> populate_page_with data_for(:Auto_Data, data)
>   endend
>
>
> I am calling DataMagic.yml_directory = 'Config/data/data_form.yml' in env.rb
>
>
>
> Thank You,
>
> Ajay.
>
>
I see no Watir code above.   You might want to seek help in a forum related 
to DataMagic as that seems to be what you are trying to make work 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Errno::ENOENT: No such file or directory - config\data/default.yml

2016-07-19 Thread Chuck van der Linden
On Tuesday, July 12, 2016 at 2:29:28 PM UTC-7, Ajay Reddy wrote:
>
> Hi All, 
>
> Can any one help me with this issue.
>
>
>
>
>
> Thank You,
> Ajay.
>

 >> Can any one help me with this issue.

as asked?  

No.  Nobody here can help you as it is unclear what your issue is beyond 
the title.   It's a bit like walking into a mechanic and saying 'my car is 
busted, how do I fix it?'  you have not provided enough information for 
anyone to be able to assist you.

Show us the code you are trying to make work, and the entire error.   If 
the failing code has nothing to do with Watir (e.g. it's not making use of 
the Watir or Watir-Webdriver gems) then you might want to ask in a more 
general support forum for ruby, such as stack overflow.

In general your best clue is in the error message.. which says it can't 
find the thing you are trying to have it find.. that means either a typo 
(name mis-match) or the current directory at the time it goes looking for 
the file is not what you think it is.. Since you are giving a relative path 
to the file, unless you happen to be in the right place to start searching. 
  e.g. you told it 'get the pot from the cubbord, but you are standing in 
the bathroom, not the kitchen.. so it tells you 'I can't find that thing 
here' 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: XLSX file format error: File reports/excel_result.xlsx not found (Zip::Error)

2016-07-19 Thread Chuck van der Linden
On Sunday, July 17, 2016 at 5:40:42 PM UTC-7, Ajay Reddy wrote:
>
> Hi All,
> I am generating excel report.
>
> Here is my code:
> module WriteReport
>   require 'spreadsheet'
>   require 'rubyXL'
>   require 'time'
>
> def self.get_blank_row
>  workbook = RubyXL::Parser.parse($result_xl)
>  worksheet = workbook['Test']
> my_rows_indx = []
> worksheet.each_with_index { |row, index|
>   my_rows_indx << index if row != nil
> }
> return my_rows_indx.last+1
>   end
>
>   def self.write_report
> workbook = RubyXL::Parser.parse($result_xl)
> row = get_blank_row.to_i
> worksheet = workbook['Test']
>
> worksheet.insert_cell(row, 0, $time, formula = nil)
> worksheet.insert_cell(row, 1, $url, formula = nil)
> worksheet.insert_cell(row, 2, $elec_disc, formula = nil)
> worksheet.insert_cell(row, 3, $check_box, formula = nil)
> worksheet.insert_cell(row, 4, $full_disc, formula = nil)
> worksheet.insert_cell(row, 5, $report, formula = nil)
> workbook.write($result_xl)
>   end
> end
>
> Here I am creating and parsing excel sheet.
> # --- getting time for file name
> $time = Time.now.strftime('%Y -%m -%d')
>
> # --- initiating excel files
> $result_temp = "reports/excel_result.xlsx"
> $result_xl = "reports/result/#{$time}_Result.xlsx"
>
> # --- Parsing excel and writing new for result
> workbook1 = RubyXL::Parser.parse($result_temp)
> workbook1.write($result_xl)
>
> In hooks.rb:
> Before('@watir')do
>   launch_browser
> end
>
> After('@watir') do
>   $report = "PASS"
>   $report = "FAIL" if scenario.failed?
>   WriteReport.write_report
>   quit_browser
> end
>  
>
> Thank You,
> Ajay.
>

I see no watir code, or anything related to watir in the code above.   I'd 
suggest you locate the proper support venue for the 'spreadsheet' or 
'rubyXL' gem(s) and ask your question there.   

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: How to identify the index of an element by text

2016-07-19 Thread Chuck van der Linden


On Monday, July 18, 2016 at 2:05:06 PM UTC-7, Soori wrote:
>
> I have a scenario where there is a grid of elements with same class name. 
> I need to identify the element position using index.
>
> For example:
>
> 
> 
> text1
> text3
> text4
> text23
> text6
> text88
> text3
> 
> 
>
>
> in the above example,  I need to find the index of the div for "text6". 
> Can you please help me how I can do this using watir?
>
> /S
>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: How to identify the index of an element by text

2016-07-19 Thread Chuck van der Linden
On Monday, July 18, 2016 at 2:05:06 PM UTC-7, Soori wrote:
>
> I have a scenario where there is a grid of elements with same class name. 
> I need to identify the element position using index.
>
> For example:
>
> 
> 
> text1
> text3
> text4
> text23
> text6
> text88
> text3
> 
> 
>
>
> in the above example,  I need to find the index of the div for "text6". 
> Can you please help me how I can do this using watir?
>
> /S
>
>
If you know the text that will be in the div you want, why not identify by 
that?  why find the index using the class, and then use index, that's just 
more steps..

 my_div = b.div(class: 'grid', text: 'text6')# (using newer style hash 
definition)
  or if you are oldschool..
 my_div = b.div(:class => 'grid', :text => 'text6')  # (using older 
hashrocket style hash definition) 

 Or to make it more generic (like if it was in a method) 

   search_text = 'text6'

   my_div = b.div(class: 'grid', text: search_text)

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Watir-webdriver throws 'not clickable' error even when element is visible, present

2016-04-22 Thread Chuck van der Linden
On Tuesday, April 19, 2016 at 4:08:52 AM UTC-7, Awesome Possum wrote:
>
> Hence the question are 1) Why does Watir throw an exception 'Element not 
> clickable' even when the element is visible and present? See ruby code ( I 
> have picked a random company website for an example) and the results below.
>
> 
>
> Selenium::WebDriver::Error::UnknownError: unknown error: Element is not 
> clickable at point (460, 1295). Other element would receive the click: div 
> class="shoppingFooter"...div
>
> (Session info: chrome=50.0.2661.75) (Driver info: chromedriver=2.21.371459 
> (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Mac OS X 10.10.5 
> x86_64)>http://shop.coles.com.au/online/mobile/national
>
> thanks!
>
> The answer to your question is right in the error message.   "Other 
element would receive the click"  That's the cause of the issue, there is 
some other element that is on top of the thing you are trying to click.

The solution depends on the situation, as there are two possibles.

1) Some other statically positioned element such as a header or footer, or 
maybe a dialog box/modal, is 'over' and obscuring the thing you want to 
click.   "but why is visible true?"  Because visible is checking attributes 
of the object, not evaluating if a user could actually see it, but rather 
making sure that the DOM or CSS styling is not hiding it.  The solution 
here is to scroll the element fully into view, see the answer talking about 
watir-scroll.

2) Some outer container is 'over' the element  even if not obscuring it. 
 In this case you can see the thing visually, but the container would get 
the click.. Which is OK because that's what would happen when a real user 
tried to click the thing.  In this case, experiment to discover the 
container and try clicking it.  See the answer from Super Kevy.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Watir-Webdriver and Docker

2016-03-21 Thread Chuck van der Linden
On Friday, March 18, 2016 at 11:41:57 AM UTC-7, Chuck van der Linden wrote:
>
> On Friday, January 29, 2016 at 2:42:52 AM UTC-8, tkp wrote:
>>
>> *Aim : *Dockerizing Watir-Webdriver tests
>>
>> *Environment:*
>>  OS : Ubuntu 14.04
>>  Browser : FF 43
>>  Docker : v1.7.1
>>
>> *Issue:*
>> Currently it is observed that opening a browser instance and navigating 
>> to a website is very slow
>> when triggered from within a Docker instance. I compared the times for 
>> loading heavy webpages
>> like yahoo.com from within Docker and from the host machine (ubuntu) but 
>> the performance is
>> pretty much the same. The difference in behavior is seen while using 
>> Watir to automate browser
>> actions.
>> Has anyone encountered anything similar?
>>
>
> Nope, I used docker containers to run Watir tests in our CI environment 
> (triggered to run after the job that deployed the code to test servers) 
>  when I was at climate.com and it worked just fine performance wise.   
> There was a tiny delay while the code for the scripts downloaded, and gems 
> and such updated, but actual runtime for the test scripts was pretty much 
> the same as running from my mac, or in a windows vm on the mac.  (browser 
> being used had more to do with runtimes than anything else)  Performance 
> wise, using jruby was slightly faster than regular ruby.
>

As an aside however, especially if containers are based off an older linux 
release, you will want to ensure that your container is  created such that 
you have a current version of whichever browser you are using.   Typically 
I use the most current Enterprise Support Release (ESR) 
<https://www.mozilla.org/en-US/firefox/organizations/faq/> of Firefox. 
 This can be critical (and can affect performance) if the default firefox 
is fairly old (such as you'd get with 'lucid' or a similar vintage of 
Ubuntu)

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Watir-Webdriver and Docker

2016-03-19 Thread Chuck van der Linden
On Friday, January 29, 2016 at 2:42:52 AM UTC-8, tkp wrote:
>
> *Aim : *Dockerizing Watir-Webdriver tests
>
> *Environment:*
>  OS : Ubuntu 14.04
>  Browser : FF 43
>  Docker : v1.7.1
>
> *Issue:*
> Currently it is observed that opening a browser instance and navigating to 
> a website is very slow
> when triggered from within a Docker instance. I compared the times for 
> loading heavy webpages
> like yahoo.com from within Docker and from the host machine (ubuntu) but 
> the performance is
> pretty much the same. The difference in behavior is seen while using Watir 
> to automate browser
> actions.
> Has anyone encountered anything similar?
>

Nope, I used docker containers to run Watir tests in our CI environment 
(triggered to run after the job that deployed the code to test servers) 
 when I was at climate.com and it worked just fine performance wise.   
There was a tiny delay while the code for the scripts downloaded, and gems 
and such updated, but actual runtime for the test scripts was pretty much 
the same as running from my mac, or in a windows vm on the mac.  (browser 
being used had more to do with runtimes than anything else)  Performance 
wise, using jruby was slightly faster than regular ruby.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Standalone app testing?

2016-03-19 Thread Chuck van der Linden
On Saturday, March 5, 2016 at 5:11:29 AM UTC-8, 4xga...@gmail.com wrote:
>
> I am investigating Watir and would like to know if I can use it to test 
> standalone apps.  (Example: I want to learn by 'testing' the Windows 
> calculator.)
> I searched 'GUI' and 'Standalone' with no hits... 
>

On Saturday, March 5, 2016 at 7:23:32 AM UTC-8, John Fitisoff wrote:
>
> Unfortunately, Watir's a browser testing tool. It doesn't work with 
> desktop apps, just browsers.
>
>
Yeah, the closest you could come is the tool that comes up when you google 
"calculator' or an online calculator such as this one 
http://web2.0calc.com/  Writing code to 'test' one of those would be a not 
bad way of getting started. 

You'd have to look at other tools to test 'native' applications, watir (as 
the name "Web Application Testing In Ruby" implies) is limited to doing 
browser automation for testing web applications. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Watir ignores the maximum character length on a text field.

2016-03-19 Thread Chuck van der Linden
On Monday, March 14, 2016 at 4:35:22 PM UTC-7, Damien Wood wrote:
>
> Hi, 
>
> I have an Angular front end and I am using Watir to test.
>
> One of the text fields 'First Name' has a max character length of 32. 
>
> When I try entering something with 33 characters manually, as you would 
> expect, it gets to 32 then stops me entering anything more. 
>
> However, if I use Watir to enter the text I can send it as many as I like. 
> It seems to totally ignore the maximum length of the field.
>
> On a related note I can also enter special characters, for example '!' in 
> the field which I cannot do manually using the keyboard. 
>
> Anyone come across anything like this?
>
> Cheers,
> Damo
>

A lot depends on the code driving your page and how such validations are 
done.  For a standard HTML input element that is controlling the input size 
with the maxlength attribute I would expect it to work.  OTOH, if you are 
using a custom control, with custom validation code then `.set` may not be 
firing the browser events that would trigger the validation.   In that case 
you might try using `.send_keys`instead as it more closely simulates a user 
actually typing at the keyboard, and see if that works better in this 
instance.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Telerik reports contents validation using watir

2016-03-19 Thread Chuck van der Linden
On Wednesday, February 10, 2016 at 10:47:22 AM UTC-8, Kiran Darekar wrote:
>
> Hi,
> We are using telerik reporting tool. I tried to locate various elements 
> but telerik is encrypting element's attributes & it is different every time 
> when we load the reports.
> Can somebody help me to create sample script using below demo.
> http://demos.telerik.com/reporting/dashboard 
> 
>

 Since we will no doubt be talking code fragments, Stack Overflow might be 
a better venue (since it has tools for embedding code blocks in questions 
and answers, better than email anyway) 

But to start with, perhaps you can show us a sample of what you have tried, 
and where it is failing.

You will likely need to identify elements based on what the user can see 
(since if they start randomizing that, it's not usable by humans) instead 
of ID or Name attributes.  You may need to select based on both the class 
and text content..   for example (sorry, not tested, so might include a 
typo) to click and view year 2002 results, the following code ought to work

browser.div(:class => 'listviewitem', :text => '2002').click

beyond that, to have meaningful discussion, let us know the code you tried, 
 a sample of the HTML, and what error you are seeing. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Html Reports in Watir

2016-03-19 Thread Chuck van der Linden
I suggest asking a new question, and providing relevant code, rather than 
necro'ing a 7 year old thread.


On Thursday, February 4, 2016 at 2:23:02 PM UTC-8, Ajay Sithagari wrote:
>
> Hi,
> How to display the "DATE AND TIME"  inside the report.
>
> Thanks,
>
> On Thursday, June 26, 2008 at 12:39:06 AM UTC-5, @90kts wrote:
>>
>> @Aidy I am using Rspec runner. Also, if using TextMate, you may find 
>> the Rspec bundle quite handy ... 
>>
>> On Jun 26, 1:39 am, "aidy lewis"  wrote: 
>> > Hi, 
>> > 
>> > Is any like myself using the Rspec story/runner or are you all using 
>> > the Test::Unit wrapper? 
>> > 
>> > Aidy 
>> > 
>> > On 25/06/2008, Charley Baker  wrote: 
>> > 
>> > > Looks like a pseudo setup/teardown. It makes more sense to put those 
>> into 
>> > > before and after, rspec's equivalent.. 
>> > 
>> > > On Wed, Jun 25, 2008 at 9:16 AM, Alan Baird <
>> alan.ba...@riskmetrics.com> 
>> > > wrote: 
>> > 
>> > > > Tim - 
>> > 
>> > > > Thanks for the example.  Does the 'should open browser' and the 
>> 'should be 
>> > > able to logout' examples test anything?  I notice that they don't 
>> have 
>> > > assertions. 
>> > 
>> > > > Alan 
>> > 
>> > > > -Original Message- 
>> > > > From: watir-...@googlegroups.com 
>> > > [mailto:watir-...@googlegroups.com] On Behalf Of 90kts 
>> > 
>> > > > Sent: Wednesday, June 25, 2008 6:41 AM 
>> > > > To: Watir General 
>> > > > Subject: [wtr-general] Re: Html Reports in Watir 
>> > 
>> > > > To use rspec a test case might look like (I'm using FireWaitr in 
>> this 
>> > > > example) ... 
>> > 
>> > > > require 'rubygems' 
>> > > > require 'firewatir' 
>> > > > require 'spec' 
>> > 
>> > > > include FireWatir 
>> > 
>> > > > describe 'being able to access the substruct website' do 
>> > 
>> > > >  it 'should open browser' do 
>> > > >  @b=Firefox.new 
>> > > >  @b.maximize 
>> > > >  end 
>> > 
>> > > >  it 'should navigate to admin page' do 
>> > > >@b.goto("http://localhost:3000/admin";) 
>> > > >@b.title.should == 'Login to access the admin area' 
>> > > >  end 
>> > 
>> > > >  it 'should be able to login' do 
>> > > >@b.text_field(:id, 'user_login').set('admin') 
>> > > >@b.text_field(:id, 'user_password').set('admin') 
>> > > >@b.button(:name, 'login').click 
>> > > >@b.title.should == 'Order List : Substruct ADMIN' 
>> > > >  end 
>> > 
>> > > >  it 'should be able to logout' do 
>> > > >@b.link(:text, 'Log Out').click 
>> > > >  end 
>> > 
>> > > > end 
>> > 
>> > > > ... then just execute with 
>> > > > spec my_test.rb --format html 
>> > 
>> > > > and you'll get results something like this in pretty html ... 
>> > > > RSpec Results 
>> > > > 4 examples, 0 failures 
>> > > > Finished in 5.365781 seconds 
>> > > > being able to access the substruct website 
>> > > > PROFILE: 
>> > > > should open browser 
>> > > > should navigate to admin page 
>> > > > should be able to login 
>> > > > should be able to logout 
>> > 
>> > > > On Jun 25, 12:57 am, "Alan Baird"  
>> wrote: 
>> > > > > Tim - 
>> > 
>> > > > > An example would be nice.  Also, do you know how keep rspec from 
>> > > suppressing the full stacktrace on error? 
>> > 
>> > > > > Alan 
>> > 
>> > > > > -Original Message- 
>> > > > > From: watir-...@googlegroups.com 
>> > > [mailto:watir-...@googlegroups.com] On Behalf Of 90kts 
>> > > > > Sent: Monday, June 23, 2008 5:28 PM 
>> > > > > To: Watir General 
>> > > > > Subject: [wtr-general] Re: Html Reports in Watir 
>> > 
>> > > > > I like using rspec to run my test cases at present. You can use 
>> the -- 
>> > > > > format html parameter to give u nicely formatted results. Let me 
>> know 
>> > > > > if you'd like an example and I'll send you one. 
>> > 
>> > > > > Cheers 
>> > > > > Tim Koopmans 
>> > 
>> > > > > On Jun 20, 9:22 pm, Sajid  wrote: 
>> > > > > > I want some help as to  how to run the tests so that it outputs 
>> some 
>> > > > > > type of HTML output for the report results.Ultimately, what is 
>> > > > > > required is to  take  these scripts and plugging them into a 
>> > > > > > Continuous Integration process so that they run on a regular 
>> basis and 
>> > > > > > email out the results of the tests. 
>> > 
>> > > > > > Thanks for all the help . 
>> > 
>> > > > > > I really appreciate. 
>> > 
>> > > -- 
>> > > Charley Baker 
>> > > blog:http://charleybakersblog.blogspot.com/ 
>> > > Project Manager, Watir,http://wtr.rubyforge.org 
>> > > QA Architect, Gap Inc Direct
>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Persistent authentication http/https

2015-12-15 Thread Chuck van der Linden
have you considered that any site that requests credentials NOT over HTTPS 
is a security risk to have those credentials stolen?  I'd file as a bug 
that you are not immediately redirected to HTTPS when it requests 
credentials.

as to having it happen automatically..  you could construct a method that 
checks for the popup and responds if it finds it, and then just call that 
method in the places this happens.   or just start out on the HTTPS page..

in terms of anything else automatic, if you can do it from the browser 
manually, then you should be able to do the same thing with 
watir-webdriver.  but be aware that a fundimental behavior of webdriver is 
to emulate what a real user can do.. if you can't do it manually (setup 
some kind of autologin) you won't likely be able to do it with any tool 
that uses webdriver.  (classic example is clicking a button the user can't 
see, if a user can't see a control to click on it (even if it is in the 
DOM) then webdriver won't let you click on it. 

On Monday, December 14, 2015 at 5:47:37 AM UTC-8, VN1 wrote:
>
> Hi
>
>
> I am using the following snippet (below) which takes me to a site and 
> authenticates.
>
> require 'watir-webdriver'
> b = Watir::Browser.start 'http://admin:passw...@yourwebsite.com'
>
> The problem I am facing is that after navigating a few pages I am once 
> again presented with the username and password popup but this time over 
> https. Is there anyway I can set the username and password and forget about 
> it? In that whenever it hits a page which requires authentication it 
> automatically logs in. If this is not possible can someone tell me how I 
> can enter a username and password to a popup and authenticate?
>
> Thanks
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Fetch number from a JavaScript function on the page

2015-07-21 Thread Chuck van der Linden
On Wednesday, June 10, 2015 at 10:08:48 AM UTC-7, kristofBLR wrote:
>
> Hello. I am trying to create a parser, that will scrape info about iphone 
> warranty status. I have an URL - 
> https://selfsolve.apple.com/agreementWarrantyDynamic.do 
> 
>  
> and i need to fill the form with an IMEI and press Continue to get info 
> about the phone. I am using mechanize for this. The problem is - there is a 
> hidden field in this form - http://goo.gl/AMlNfC And this field is filled 
> automatically with a random number when i interact with page via browser. 
> So if i open this page with mechanize, i should fill this field manually 
> with that random generated number. I've figured out in which part of code 
> this number generated - http://goo.gl/P8nvpx The problem is - it's inside 
> JavaScript function. I am not very strong at JS and i have no idea how to 
> fetch this number using mechanize. Maybe Watir can help me do this? The 
> problem is, i don't understand how Watir interact with JavaScript on the 
> page. I know how to fetch data from HTML with Xpath, or with CSS selectors, 
> but i have no idea how can i get that number from JS function. Any help 
> will be appreciated.
>

Word of caution, check the terms of service on that site, they pretty 
specifically disallow what you are talking about doing

You may not use any “deep-link”, “page-scrape”, “robot”, “spider” or other 
> automatic device, program, algorithm or methodology, or any similar or 
> equivalent manual process, to access, acquire, copy or monitor any portion 
> of the Site or any Content, or in any way reproduce or circumvent the 
> navigational structure or presentation of the Site or any Content, to 
> obtain or attempt to obtain any materials, documents or information through 
> any means not purposely made available through the Site. Apple reserves the 
> right to bar any such activity.


So it would be best to contact apple for permission, or find out if there 
is an API you could access to do what you want (which is superior to trying 
to do site scraping)

Be warned that many community members will not respond to requests for help 
automating against a site where their terms of use prohibits such things. 
 (which might explain the long duration this question went without response

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Fetch number from a JavaScript function on the page

2015-07-21 Thread Chuck van der Linden
On Wednesday, June 10, 2015 at 10:08:48 AM UTC-7, kristofBLR wrote:
>
> Hello. I am trying to create a parser, that will scrape info about iphone 
> warranty status. I have an URL - 
> https://selfsolve.apple.com/agreementWarrantyDynamic.do and i need to 
> fill the form with an IMEI and press Continue to get info about the phone. 
> I am using mechanize for this. The problem is - there is a hidden field in 
> this form - http://goo.gl/AMlNfC And this field is filled automatically 
> with a random number when i interact with page via browser. So if i open 
> this page with mechanize, i should fill this field manually with that 
> random generated number. I've figured out in which part of code this number 
> generated - http://goo.gl/P8nvpx The problem is - it's inside JavaScript 
> function. I am not very strong at JS and i have no idea how to fetch this 
> number using mechanize. Maybe Watir can help me do this? The problem is, i 
> don't understand how Watir interact with JavaScript on the page. I know how 
> to fetch data from HTML with Xpath, or with CSS selectors, but i have no 
> idea how can i get that number from JS function. Any help will be 
> appreciated.
>

Since watir-webdriver interacts with the browser in much the same way a 
real user would (it actually drives the browser) it does not need to try to 
parse or execute JS code, since the browser does that.   So watir is likely 
going to be able to do what you need.

Since you are starting from zero, I might recommend looking at some of the 
basics at watir-webdriver.com, or for a more in depth tutorial 
consider https://leanpub.com/watirbook

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Tutorial for Minitest with Watir Web driver for testing Web App

2015-07-21 Thread Chuck van der Linden
On Thursday, July 9, 2015 at 10:02:43 AM UTC-7, VIDYA SAGAR POGIRI wrote:
>
> Hello ,
> I m doing automation testing for a .net web app using ruby i'm more 
> interested to use minitest with watir-web driver.So kindly send me any 
> references or tutorials regarding this and thanks a lot for helping in 
> advance.
>

Did you try a google search?   
https://www.google.com/search?q=watir-webdriver+minitest  returned several 
results on the first page that looked promising 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Chrome headless testing with watir-webdriver

2015-07-21 Thread Chuck van der Linden
On Thursday, June 18, 2015 at 5:33:52 PM UTC-7, RM wrote:
>
> Hello,
>
> I have 'headless' gem installed and is running fine with watir-webdriver 
> (it use the default firefox headless).
> would like to know if anyone has successfully done headless testing with 
> chrome and watir-webdriver?
>
> Any help would be appreciated.
>
> Thanks
>
> RM
>

What operating system?   if some flavor of linux have you tried using Xvfb 
to create a virtual frame buffer for the video?  that is a tactic many 
folks use to do 'headless' testing via Jenkins etc 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Button Element not visible in watir

2015-07-21 Thread Chuck van der Linden
On Tuesday, July 21, 2015 at 5:24:04 AM UTC-7, Mahesh Mesta wrote:
>
> I'm using watir to perform automated testing for an application and trying 
> to click on a submit button once I select options for select list and fill 
> up the form.However on clicking the button, it throws element not found 
> error 
>
>
> The html snippet for button tag
>
> Submit   
> 
>
> The ruby script
>
> require "watir"require "watir-webdriver"
> browser =  Watir::Browser.new :firefox
> browser.goto 'https://54.69.254.137/webui#/landing'
> browser.driver.manage.window.maximize
> browser.button(:class =>'sign-in md-button md-default-theme').click
> browser.text_field(:id =>'input_001').set('abcad...@example.com')
> browser.text_field(:id =>'input_002').set('password')
> browser.button(:class =>'md-primary md-raised md-button md-default-  
> theme').click
> browser.input(:id =>'input_002').when_present.click
> browser.element(aria_label:'What do you want to do?').when_present.click
> browser.element(:id =>'select_option_00G').when_present.click
> browser.element(aria_label:'About what?').when_present.click
> browser.element(:id =>'select_option_00P').when_present.click
> browser.textarea(:id =>'input_00N').when_present.set('Discuss about 
> javascript and later test the application??')
> browser.button(:class =>'md-primary md-raised md-button md-default-   
> theme').click
>
> It throws the following error
>
> Selenium::WebDriver::Error::ElementNotVisibleError: Element is not 
> currently visible and so may not be interacted with
>
>
> I tried using 
>
> browser.button(:class =>'md-primary md-raised md-button md-default-
> theme').when_present.click
>
> ,but it will throw time out error.Not able to rectify the error .Plz help 
> !!
>

So the error you are seeing means that webdriver itself is able to find an 
element using the criteria you specified, but it believes the element is 
not visible to the user (off screen, hidden, or covered by another 
element).  Webdriver tries very hard to not allow you to do something a 
real user could not do, so while it was able to locate the element in the 
DOM, if it does not believe that a user could 'see' the button it refuses 
to click on it and throws the error you saw.

There are a few possibilities as to what could cause this in a case where 
you can 'see' the button.  The most likely is that there is more than one 
button in the DOM with the class combination you specified, which is often 
the case in fancy sites with multiple 'pop-up' UI elements, Tabs, etc where 
DOM elements are appearing and disappearing by tweeks to their css 
settings.. 

To check for that, you can get a count of the number of elements that match 
your specification

count =  browser.buttons(:class =>'md-primary md-raised md-button 
md-default-theme').size 

puts "there are #{count} buttons of the type we are looking for"


if the count is larger than 1, then likely watir is finding the first button 
that matches (which it will in this case) but that button is hidden.  You will 
likely want to find a container (e.g. if the UI has tabs, the div that contains 
the contents of the active tab) and specify that watir should look inside that 
element to find the button you want.  which might look something like


browser.div(:name => 'Tab3').button(:class =>'md-primary md-raised md-button 
md-default-theme').click

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: unable to locate element using {browser.element(:tag_name=>'td', :id=>'dijit_MenuItem_16_text')

2015-07-21 Thread Chuck van der Linden
So specifying the entire path to get to an element tends to create brittle 
code, one error in the 'chain' or one change to the page and you are sunk

secondly, in general it is best to use the method for the element type you 
want, this ensures that proper methods will be present in the returned 
object, e.g. set methods on a text field, etc

ID values, by HTML standards should be unique, so in a case like that there 
is no reason to specify the other container elements that enclose the thing 
you want.  You really only want to do that if you need to be sure that the 
one element is inside another, or it would be ambiguous otherwise as more 
than one element with a given set of properties exists.

So combining all that, you ought to be able to do a much more direct access 
of your element by using

browser.td(:id => 'dijit_MenuItem_16_text').exists?

If that comes back negative, then I would look to see if there is a frame 
and the elements are inside the frame.  Since each frame acts like it's own 
browser window with it's own DOM, you MUST specify frames when elements are 
inside them, aside from typos or using wrong identifiers for an element, 
that is the most common cause of exists? returning false

On Thursday, May 14, 2015 at 10:07:21 AM UTC-7, Jing Xie wrote:
>
> I am trying to select an element from a table of dropdown menu and found 
> that I am not able to locate that.
>
> @browser.div(:id, 'wikiActionMenuLink_dropdown').element(:tag_name, 
> 'table').element(:tag_name, 'tbody').element(:tag_name => 'td', :id => 
> 'dijit_MenuItem_16_text').exists?
> The output is false. Below is the html. Could someone give me some 
> suggestions?
>
>
> 
> 
>  role="menuitem" data-dojo-attach-point="focusNode" style="-moz-user-select: 
> none;" aria-label="Edit Wiki " title="Edit settings of this wiki." 
> widgetid="dijit_MenuItem_15">
> 
>  ="presentation" data-dojo-attach-point="containerNode,textDirNode" colspan
> ="2">Edit Wiki
>  data-dojo-attach-point="accelKeyNode" style="display: none">
> 
> 
>  role="menuitem" data-dojo-attach-point="focusNode" style="-moz-user-select: 
> none;" aria-label="Delete Wiki " title="Delete this wiki." widgetid="
> dijit_MenuItem_16">
> 
>  ="presentation" data-dojo-attach-point="containerNode,textDirNode" colspan
> ="2">Delete Wiki
>  data-dojo-attach-point="accelKeyNode" style="display: none">
> 
> 
> 
> 
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Drag n Drop not working for me with Firefox version25

2015-03-19 Thread Chuck van der Linden
Why use such an old version of Firefox?  Unless you are in a very unique 
situation aprox zero real world users will be using a Firefox from 2013.  Most 
home users will be on a very current version such as 35 or 36, most corporate 
users on the same, or the ESR release (31, moving to 38 in 2-5 months)

Updating test system images or containers can be a hassle yes, but I would 
recommend using as least the current ESR release of FF and updating once a new 
ESR is out.   See https://www.mozilla.org/en-US/firefox/organizations/faq/ for 
details

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Can I catch console errors using watir webdriver

2015-03-18 Thread Chuck van der Linden
If you can get a little help from your developers this is doable see 
http://watirmelon.com/2012/12/19/using-webdriver-to-automatically-check-for-javascript-errors-on-every-page/
 for one approach 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Automate AngularJS Hystrix Dashboard

2015-03-11 Thread Chuck van der Linden
Are the elements you are trying to locate located inside a frame or iframe?

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Did a Firefox update just break Watir Webdriver?

2015-03-03 Thread Chuck van der Linden
On Tuesday, March 3, 2015 at 12:22:12 AM UTC-8, Philip Undisclosed wrote:
>
> Wondering if others are seeing this or if it's specific to my 
> configuration. 
>
> irb(main):003:0> b = Watir::Browser.new :firefox
> Selenium::WebDriver::Error::WebDriverError: unable to obtain stable 
> firefox connection in 60 seconds (127.0.0.1:7055)
> from c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0
> /lib/selenium/webdriver/firefox/launcher.rb:79:in `connect_until_stable'
>
>
> Full stack trace: http://pastebin.com/YE46kYsz
>
> Firefox just updated to Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) 
> Gecko/20100101 Firefox/36.0. I'm on Windows 8. Alas, from my cursory 
> search, is seems that downgrading Firefox is strongly deprecated.
>

technically it did not break watir-webdriver.. that is nothing in that code 
is broken.  Unfortunately a quick google search seems to indicate that 
Firefox36 DID break Webdriver..  and since as you can likely guess from the 
name, watir-webdriver uses webdriver to drive the browsers, it does mean 
that until webdriver is fixed we are effectively 'broken' from the user's 
perspective.. along with capybara, and any other gem or tool that uses 
webdriver.  

Your best route 'back' is probably to see if the latest Firefox ESR release 
 still works. 
that is easy to locate and download (where finding older regular FF 
releases can be, um, fun.  For just the reason you are seeing, I tend to 
stick to using the ESR release on things like Jenkins slaves or containers 
that will be used to run tests.  I use that stuff for my automated testing, 
for stability, but use current 'consumer' version for manual testing. 
 (virtual machines are your friend) 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Can't get the content generated by ajax response

2015-03-03 Thread Chuck van der Linden
On Tuesday, March 3, 2015 at 12:28:05 AM UTC-8, Gao Boswell wrote:
>
> I have a spider that want to crawl some data of a movie site, but I found 
> that these data was generated through ajax after the page loaded,and my 
> code is:
> require 'nokogiri'
> require 'watir-webdriver'
>
> browser = Watir::Browser.new 
> browser.goto '
> http://www.tudou.com/albumplay/2Dk1-JIVpzo/yp927-uKGMs.html?FR=LIAN'
> browser.element(:css => "#digBury .dig_container").wait_until_present
> puts '***'
> puts browser.html
> puts '***'
> doc = Nokogiri::HTML(browser.html)
> content = doc.css(".dig_container .num")
> browser.close
>
> from the output I can get the content which I want:
> 在此输入代码...
>
> 
> 
> 
> 
> +1
> 332
> 
>
> 
> 
>
> but I know that on the server I must use headless ,so I changed my code to:
> require 'nokogiri'
> require 'watir-webdriver'
> require 'headless'
>
> headless = Headless.new 
> headless.start
>
> browser = Watir::Browser.new 
> browser.goto '
> http://www.tudou.com/albumplay/2Dk1-JIVpzo/yp927-uKGMs.html?FR=LIAN'
> browser.element(:css => "#digBury .dig_container").wait_until_present
> puts '***'
> puts browser.html
> puts '***'
> doc = Nokogiri::HTML(browser.html)
> content = doc.css(".dig_container .num")
> browser.close
> headless.destroy
>
> this time I can't get my result,and the result is:
> 
> 
> 
> 挖
> 
> 
>
> the diffrence is I have added headless and the effect is  the ajax request 
> don't send or the ajax response I missed ,how can i fix this problem?
>

You might try using phantomjs instead of headless.  download the 
appropriate phantomjs  executable and place on your 
path  then for the browser use :phantomjs

also: if spidering be well behaved, get the robots.txt file from the site 
and only access allowed pages.  In addition review the user agreement or 
terms of service and be sure that using a robot or any kind of automation 
to access the site is not forbidden..  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Check datatypes

2015-03-03 Thread Chuck van der Linden
On Monday, March 2, 2015 at 10:35:27 PM UTC-8, Ping-0t wrote:
>
> Hello Guys,
>
> Can someone help me with this:
>
> require 'rubygems'
> require 'watir'
> require 'test/unit'
> require 'win32ole'
> gem "test-unit"
>
> class View_OrderDetails < Test::Unit::TestCase
>
> $sales_order_no = "SO1"
> # $fields = ["order_no", "customer_name", "username"]
> # $success = 0
> # $error = 0
>
> def test_in()
>   
> @browser = Watir::Browser.new :firefox
> @browser.goto(pageUrl)
> accept_next_alert = true
> @browser.driver.manage.window.maximize
>
> excel = WIN32OLE::new("excel.Application")
> wrkbook = excel.Workbooks.Open("C:\\toFocus\\test.xlsx")
> wrksheet = wrkbook.worksheets(1)
> wrksheet.select
>
>
> #  Authentication / Login Part ---
> rows = 2
> while rows <= 4
> $username = wrksheet.cells(rows, "A").value
> $password = wrksheet.cells(rows, "B").value
>
> @browser.text_field(:name, "username").set($username)
> sleep 3
> @browser.text_field(:name, "password").set($password)
> sleep 3
> @browser.button(:name => 'login').click
> sleep 3
>
> rows = rows + 1
> end
>
> @browser.wait_until{@browser.link(:text, "Sales").click}
> @browser.link(:text, "Orders").click
> sleep 3
> @browser.wait_until{@browser.link(:text, $sales_order_no).click}
>
> (0..2).each do |i|
> if @browser.element(:class => $fields[i]) == /\A[+-]?\d+\Z/
> puts "Success"
> $success = $success + 1
> else
> puts "Erroneous"
> $error = $error + 1
> end
> end
>
> @browser.button(:data_role, "edit").click
> sleep 5
> puts "Number of Success: #{$success}"
> puts "Number of Errors: #{$error}"
>
> @browser.close
>
> end
> end
>   I want to check the details from the view details if it is numeric, 
> alphanumeric, a varchar or etc. , 
>
>
> Any help is much appreciated.
>
>
> Thanks in advance :)
>
>
> Ping
>
>
First off, way more code than we need to see, try to limit code samples to 
the minimum someone needs to see in order to assist you, For example, I 
don't need to see login code unless your issue is with logging in.  it's 
just noise and makes it harder for folks to help you.
.
Second, a bit of the html you are trying to work with would be useful.

Third: you say ''when I view details"  when is that?  there are no 
comments, no variables named 'details' in short not a single thing to tell 
us where in the code you consider yourself to be 'viewing details'

Fourth  HTML does not really have data- typing.. everything is text 
(strings basically).  and Ruby does not declare types and is pretty good 
about casting to other types, so if you extract HTML Text into a variable, 
and ask what type it is, you are most likely going to get 'string' even if 
the contents are 12345.67.  if you try to test by casting the value to a 
specific type, it will often succeed (eg casting a string holding 12345 to 
a float will work.

So the best thing you could do is check to see if the value matches a 
regular expression pattern.  Do some googling to research regular 
expressions in ruby.  Use a site like http://rubular.com/ to play with 
regular expressions, throw various test values at a regex you create and 
see if it behaves as you expect.  Be sure your expressions specify to match 
the entire thing, or a match for an 'int' would return true against "my 
favorite number? 5 for sure"  Also do bear in mind that many 'types' are 
also subtypes..  e.g. an int (numbers with no decimal) is also technically 
'alphanumeric' which normally means numbers or letters.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: How to display content of text file in the browser using watir?

2015-02-20 Thread Chuck van der Linden
On Tuesday, February 17, 2015 at 4:18:31 AM UTC-8, Hopper wrote:
>
> +1 for Cucumber.
>
> For a while now I've been looking for something that would output simple 
> HTML reports with embedded screenshots for failures.  Crucially, I wanted 
> something simple and quick to implement.
> I had previously read the article that Chuck linked, and it deterred me 
> for a long time, but I caved in yesterday and decided to give Cucumber a 
> go.  I have to be honest, I really like it.  Once you get your head around 
> it, it's very easy to use and the reports it outputs are very easy for 
> anybody to understand.
>
> I have scripted mine so that it only includes screenshots of failed steps.
>
> I'm no expert but feel free to PM me if you need a hand.
>
> For anyone using cucumber, I strongly recommend two things.  

1) READ "The Cucumber Book"  it's good stuff and really will get you off 
onto the right foot. 

2) See if you can get your product owner to read "Specification by Example" 
 and maybe get on board with using cucumber as it is intended

3) (ok, three things)  Be aware that the most common traps for testers to 
fall into and avoid them

   - Do Not create cucumber features that have way too much implementation 
   detail in them  google 'you're cuking it wrong'
   - Keep the actual details of what gets clicked etc inside the step code, 
   not in the step names and feature files. 
   - DO NOT try to cram keyword driven automation into cucumber steps,
   - Do Not make step reuse your holy grail.  That way lies the madnexx of 
   coding steps that end up with like 4 capture groups and 5 case 
   statements.and fill two screens  "one step to rule them all' is evil. 
   - DO use abstraction layers.  I really happen to like the Test-Factory 
   gem for implementing a simple light weight page object pattern. 
   

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Ruby Watir to get specific html element of a page

2015-02-20 Thread Chuck van der Linden
On Tuesday, February 17, 2015 at 5:51:17 PM UTC-8, Nice Faith wrote:
>
> I have this line of codes:
>
> if @browser.text_field(:id => "street").exists?
>   puts "street exist"
>   puts @browser.text_field(:id => "street").html
> else
>   puts "street does not exist"
> end
>
> and the result is:
>
> Run options: 
>
> # Running tests:
>
>
>
>
>
>
> street exist
> E
>
> Finished tests in 83.598781s, 0.0120 tests/s, 0. assertions/s.
>
>   1) Error:
> test_login(TC_Login):
> Selenium::WebDriver::Error::JavascriptError: invalid 'in' operand a
> [remote server] http://sample.org/user/ line 68 > Function:18:in `G'
> [remote server] http://sample.org/user/ line 68 > Function:18:in 
> `anonymous/ [remote server] http://sample.org/user/ line 68 > Function:15:in 
> `anonymous/<'
> [remote server] http://sample.org/user/ line 68 > Function:15:in 
> `anonymous'
> [remote server] http://sample.org/user/:68:in `handleEvaluateEvent'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/response.rb:52:in
>  
> `assert_ok'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/response.rb:15:in
>  
> `initialize'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:59:in
>  
> `new'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:59:in
>  
> `create_response'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/default.rb:66:in
>  
> `request'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/http/common.rb:40:in
>  
> `call'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:640:in
>  
> `raw_execute'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:618:in
>  
> `execute'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/remote/bridge.rb:339:in
>  
> `executeScript'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/webdriver/common/driver.rb:193:in
>  
> `execute_script'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/atoms.rb:20:in
>  
> `execute_atom'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriver/elements/element.rb:290:in
>  
> `outer_html'
> excel.rb:277:in `test_login'
>
> 1 tests, 0 assertions, 0 failures, 1 errors, 0 skips
>
> It diplays "street exist"...so the problem there is on displaying the html.
>
>>
>>
1) are you sure there is any actual HTML code (tags etc) contained by the 
text field object?   Do you maybe just want to use .text instead of .html?  

2) your error is on line 277 of excel.rb ,.,  what is on that line?  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: watir-webdriver using ruby on skype...hope it will useful to everyone

2015-02-20 Thread Chuck van der Linden
(sorry hit early)..Those of us that can respond rapidly and don't mind 
doing so are usually on IRC 
  https://github.com/watir/watir/wiki/IRC-Channel

On Friday, February 20, 2015 at 12:15:27 AM UTC-8, Chuck van der Linden 
wrote:
>
> Most of us have day jobs and would not be able to just respond to skype 
> requests at the drop of a hat. 
>
> On Wednesday, February 18, 2015 at 12:10:32 AM UTC-8, rocky wrote:
>>
>> Dear all,
>>
>> Sharing knowledge on skype,who are all interest send your skype id so 
>> that we can solve  watir-webdriver issues instantly.
>>
>> Hope it will useful to all .."*sharing your knowledge is key to 
>> success* "
>>
>> Regards,
>> Sri.
>>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: watir-webdriver using ruby on skype...hope it will useful to everyone

2015-02-20 Thread Chuck van der Linden
Most of us have day jobs and would not be able to just respond to skype 
requests at the drop of a hat. 

On Wednesday, February 18, 2015 at 12:10:32 AM UTC-8, rocky wrote:
>
> Dear all,
>
> Sharing knowledge on skype,who are all interest send your skype id so that 
> we can solve  watir-webdriver issues instantly.
>
> Hope it will useful to all .."*sharing your knowledge is key to 
> success* "
>
> Regards,
> Sri.
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: How to write a test script for login and logout in ruby in a firefox browser

2015-02-20 Thread Chuck van der Linden
On Wednesday, February 18, 2015 at 10:11:03 AM UTC-8, Hifi wrote:
>
> How to write a test script for login and logout in ruby in a  firefox 
> browser
>


Try this http://lmgtfy.com/?q=login+test+script+example+watir 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: MooTools 1.5.1: Unable to get property 'prototype' of undefined or null reference

2015-02-20 Thread Chuck van der Linden
um where does Watir factor into the question below? 

On Thursday, February 19, 2015 at 10:01:55 AM UTC-8, Michael wrote:
>
> Hello,
>
> Recently in IE 11.0.9600.17280 on Windows 7 I have been getting this error:
> Unable to get property 'prototype' of undefined or null reference
>
> The undefied or null reference is: Function
>
> For this chunk of compressed code right near the top of the MooTools 1.5.1 
> Core:
> Function.prototype.overloadSetter=function(usePlural){var self=this;return 
> function(a,b){if(a==null)return this;if(usePlural||typeof 
> a!='string'){for(var k in a)self.call(this,k,a[k]);if(enumerables)for(var 
> i=enumerables.length;i--;){k=enumerables[i];if(a.hasOwnProperty(k))self.call(this,k,a[k]);}}else{self.call(this,a,b);}
> return this;};}
>
> See attached screenshot for details. Even if the debugger is closed it 
> pops up prompting debugging. Not every time, maybe half the time.
>
> Anyone else seen this? Any suggestions? I can't find anything on MSDN or 
> elsewhere on the web regarding this issue. I thought Function was provided 
> by the browser, so curious if there is some reason MooTools is being 
> initialized or run even before IE initializes all its own objects.
>
> Thanks,
> Michael
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Getting the line number of the error of the web application we are testing using watir. Is it possible?

2015-02-20 Thread Chuck van der Linden
if you can get cooperation from your developers there are some tactics 
where by you can get information about any JS errors.   I do something like 
that, and for all failing tests one of the things the code does is check to 
see if there was a JS error that occured, and report the details if there 
was. 

reference: 
  
http://itreallymatters.net/post/384269592/capturing-javascript-errors-with-watir#.VObrjfnF_uM
 
 
 and
  
http://watirmelon.com/2012/12/19/using-webdriver-to-automatically-check-for-javascript-errors-on-every-page/

On Thursday, February 19, 2015 at 5:17:30 PM UTC-8, Ping-0t wrote:
>
> Good Day!
>
>
> Hi guys, I am really confuse about my task. It is by getting the line 
> number of the error from the web application we are testing not from the 
> script we are using to test the web application. I am just wondering if is 
> it possible to happen using watir?
>
> Any help is greatly appreciated. Thanks in advance :)
>
>
> Best regards,
>
> Ping
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Unexpected output..

2015-02-20 Thread Chuck van der Linden
On Thursday, February 19, 2015 at 10:50:18 PM UTC-8, Ping-0t wrote:
>
> Hello Guys,
>
> Again I am having trouble about my testing? I got this warnings in the 
> inspect element console when I try to execute my codes [below].
>
> Use of getPreventDefault() is deprecated.  Use defaultPrevented instead. 
> jquery.min.js:3
> Use of getAttributeNode() is deprecated. Use getAttribute() instead.
> Security wrapper denied access to property length on privileged Javascript 
> object. Support for exposing privileged objects to untrusted content via 
> __exposedProps__ is being gradually removed - use WebIDL bindings or 
> Components.utils.cloneInto instead. Note that only the first denied 
> property access from a given global object will be reported.
>
> My codes:
>

Those sort of things appearing in the developer tools console are usually 
coming from javascript code within the web pages of your site.  You should 
report them to your developers, but you need to be sure what page you were 
on, or what actions resulted in seeing the errors.

Warnings I would generally just ask someone if they know or care about 
them.  often they already know

Any actual errors there should be reported, they usually represent a 
problem with their code, or how they are using a standard library like 
jquery 


> Then after the execution I got this kind of output: 
>
> E
> User1@DOCUMENTATIONS /c/testing
> $ ruby revised_login.rb
> Warning: you should require 'minitest/autorun' instead.
> Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
> From:
>   c:/Ruby193/lib/ruby/1.9.1/minitest/autorun.rb:14:in `'
>   revised_login.rb:2:in `'
> MiniTest::Unit.autorun is now Minitest.autorun. From 
> c:/Ruby193/lib/ruby/1.9.1/m
> initest/autorun.rb:18:in `'
> MiniTest::Unit::TestCase is now Minitest::Test. From
> ...


The first bit of that is  telling you that they way to require minitest has 
changed and you need to update your code.  there is likely something about 
it on the main site (often a github page) for minitest.   I don't use 
minitest so I can't give you more details than that.  

But likely you are basing what you have for minitest on some blog or site 
that is now out of date due to changes in minitest.  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Ruby Watir to get specific html element of a page

2015-02-17 Thread Chuck van der Linden
On Tuesday, February 17, 2015 at 1:32:36 AM UTC-8, Nice Faith wrote:
>
> Ahmf. the web element is present..But when I try to print/put it it 
> doesn't work.
>

can you provide us with the URL to the page you are working with?

what does 'it doesn't work' mean?  did you get an error, 

Can you show us the code you tried to run, or if using IRB copy what you 
typed and what responses you got. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Watir does not supply credentials to IE

2015-02-17 Thread Chuck van der Linden


On Saturday, January 24, 2015 at 2:55:32 PM UTC-8, Bhuvan Sundar wrote:
>
> Hi All,
>
> I am new to Ruby.Just beginner.Started with below procedure
>
> 1. installed Ruby 1.9.3 version on windows 7 
> 2.installed watir-webdriver
>
> had written code for gmail login on chrome.Here my problem is unable to 
> set the value to field Email text box.please let me know anything is wrong 
> in below code
>
> require 'watir-webdriver'
>
> CM=Watir::Browser.new :chrome
> CM.goto "https://www.gmail.com";
>
> CM.driver.manage.window.maximize
> CM.driver.manage.timeouts.implicit_wait=5
>
> CM.text_field(:id,"Email").when_present_Set "a"
> CM.text_field(:id,"Passwd").set "b"
>
> CM.button(:id,"ignIn").Click
> Thanks,
> Bhuvan
>
>
>
>
1) I presume you have replaced real values with 'a' and 'b'   (since of 
course 'a' is not a valid email address, and 'b' would be a stupidly bad 
password.

2) style nitpick:  in ruby, variables named in all caps are normally 
presumed to be constants..  it's not strictly enforced but will drive 
anyone reviewing your code batty to see such like 'CM' all over the place 
if the value is not in fact a constant.   

3) maybe you are getting a different experience than me depending on where 
you are in the world, or browser, but when not logged in, there are no 
sign-in fields on the main gmail.com page, you have to click a link to sign 
in and that takes you to a different page 
(https://accounts.google.com/ServiceLogin?service=mail&continue=https://mail.google.com/mail/)
 

4) likely the cause of your issue:  ".when_present_Set" is not a method. 
 you want ".when_present.set"  (two methods, one after the other)

5) potentially a second problem once you fix the first.  again maybe a 
different sign in page, but on the one I see, the button to submit the 
credentials as an ID of 'signIn' not "ignIn"

correcting for the above, I would expect the last three lines of your 
script to be

cm.text_field(:id,"Email").when_present.set "youremailn...@yourdomain.com"
cm.text_field(:id,"Passwd").set "yourpassword"
cm.button(:id,"signIn").click

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Is it possible to locate/set shadowed by element

2015-02-17 Thread Chuck van der Linden
On Thursday, January 8, 2015 at 12:26:20 AM UTC-8, mc060200778 wrote:
>
> HI,
>
> I want to set following checkbox but it is 
> shadowed by Label For element. So i can't execute b.checkbox().set 
> method... it is giving an error. How do i set checbox in this case?
>
>  data-ng-model="jobReport.DailySummaryCompleted">
>  
>
> Further, is it still valid issue? "It is not possible to find the 
> checkbox by its label (as it appears to be comparing a Watir::Label 
> object):"
> https://github.com/watir/watir-classic/issues/56
>

56 was split into issues 57-60  some of which were resolved only about 10 
days ago.   So you will want to take a look at the most recent code (you 
can tell rubygems to get it from github) to see if that takes care of your 
problem of selecting based on the label. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: verify if checkbox is checked

2015-02-17 Thread Chuck van der Linden
On Wednesday, January 28, 2015 at 7:27:23 AM UTC-8, Super Kevy wrote:
>
> Based on this syntax try:
>
> 
> Dependent to an existing member?
> 
> 
> 
>
>
> @browser.label(:text=>"Dependent to an existing 
> member?",:class=>class="custom-checkbox 
> checked" ).exists?
> or 
> @browser.label(:text,"Dependent to an existing member?").checkbox.set?
>
>
> Not sure why the label is containing the input, that looks weird.
>
>
>
Jack,   did this help you solve your problem?  or are you still struggling 
with this.   (some custom controls like this can be a real pain to test 
against, but there is usually a way around them.

 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Validating a drop down value which is disabled

2015-02-16 Thread Chuck van der Linden
On Monday, February 2, 2015 at 2:35:24 PM UTC-8, praneetha pagidimarri 
wrote:
>
> Hi,
>
> I've to validate the value of a disabled dropdown on a page.
> I used an instance variable to read all the values and used as .text to 
> validate against the page values.
>
> Fields which are in enable mode and are text are showing accurate results, 
> but fields which are in disabled mode with values in dropdown boxes are not 
> validated.
> Can any one suggest on this issue please.
>

can you provide sample HTML?  

Forms that have fields that can be enabled and disabled according to other 
values often have a lot of JS code that processes things as fields are 
changed and also when the form is submitted.  So potentially a field could 
be set to a given value by the user, then later disabled when another value 
is changed.  and inspecting the value in that field at that time tells you 
very little

For example say that a form had a checkbox for 'use custom timeout' and a 
timeout value field that was enabled when the checkbox was checked. The 
user might be able to enable the checkbox, enter a value, then disable the 
checkbox, leaving the value they entered just sitting there grayed out.  

  In that case when the form is submitted, the JS code could decide to omit 
that field entirely, or send a default value.  Or it might just send 
everything, and depend on code on the back end to know it should ignore the 
custom timeout value when custom timeout is not enabled.  Without knowing 
exactly what the thing is SUPPOSED to do, where the logic is, trying to 
verify the 'current' value of the field before submitting the form won't 
tell you if things are working right or not..  Instead you might likely 
need to monitor the HTTP traffic to see what really got sent, or inspect 
what data was saved at the back end after the form was submitted.   you 
could do that by inspecting some 'settings' page in the app that displayed 
the values, or maybe by hitting the DB directly to validate the right 
things were persisted. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Does watir checks inputs datatype?

2015-02-16 Thread Chuck van der Linden
On Tuesday, February 10, 2015 at 9:21:45 PM UTC-8, Ping-0t wrote:
>
>  Hello Again guys,
>
> I am just wondering if watir checks inputs datatype? I keep on searching 
> here since this morning but until now I cannot find the answer. Someone 
> knows? Because I need to know for my task..
>
> Thanks again :)
>
> Helfe
>

in HTML forms there are no dataypes, everything is a string.  even spinner 
controls that let you select numbers, date pickers, etc  it's ALL a string 
when you look at the actual HTTP POST traffic.

Webpages can implement client side javascript to ensure that the values a 
user provides fit some particular pattern, anything from being an integer, 
to a potentially valid e-mail address. and prevent a non-malicious user 
from submitting data outside given ranges/patterns when using your site as 
intended.  You can easily create tests to validate such things by trying to 
input 'invalid' values and verifying that the form will not allow you to 
submit, and provides appropriate messages to tell the user what they did 
wrong.  But do understand ultimately two things.

 1) watir has no idea if such client side code exists, and no way to 
automagically know if an input field has JS code that tries to enforce such 
a restriction on input to that field.  For that matter you would not want 
watir to prevent you from using an invalid value because that would prevent 
you from trying to test the form by inputting such values.  You need to be 
able to do any silly thing (or purposely bad thing) that a user might try 
to do in order to see that the site responds correctly.   Also, even if 
watir could look at the JS and sus out the acceptable range of values for a 
field, that would not tell you if the code was correctly implementing the 
story for that form.  If we were just to look at the code and test 
according to what we see, we could potentially tell if the code 'worked 
right' but would have no idea if it was actually 'doing the right work'. 
 So were such a capability to exist, it would mostly provide a false sense 
of security instead of having real value.

  2) from a more pragmatic 'security geek' standpoint, while such client 
side JS code is 'nice' from the perspective of a good user experience, it 
does pretty much ZERO in terms of protecting your webserver and the systems 
below it from invalid input.  That is because it is trivially easy in most 
cases to 'spoof' such input, particularly where form data may be submitted 
to something like a REST API.  It takes minimal skill to do an 'end-around' 
on the client side JS code and submit all sorts of malicious crap to your 
webservers.  So please insure that your programmers are also validating 
inputs at the back end, before trying to make use of any data that comes 
from the web client.  Or better yet, learn how to do such spoofing yourself 
and include that in your testing.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: How to display content of text file in the browser using watir?

2015-02-16 Thread Chuck van der Linden
On Monday, February 16, 2015 at 6:38:47 PM UTC-8, Joe Fl wrote:
>
> Hi,
>
> Here is a discussion about using CLReport which is disguised here in the 
> group.
>
>
> https://groups.google.com/forum/#!searchin/watir-general/Clreport/watir-general/TYJzYeLmC2c/36vWuMQ5WHMJ
>
> you can build a nice report and then launch in a browser when the tests 
> are done.
>
> You guys might look into Cucumber or rspec with Jenkins which will provide 
> a nice automation test result page in a browser.
>
> Joe
>
>
The main reason to use Cucumber is as a collaboration tool to insure that 
everyone on the team has a clear understanding of how what you are building 
is supposed to behave. 
 (see 
https://cukes.info/blog/2014/03/03/the-worlds-most-misunderstood-collaboration-tool.html
 
)

That said, things like nice pretty HTML reports (which can even feature 
embedded screenshots) are a really nice 'side benefit' of the tool.  Those 
benefits (along with not having to create your own framework, re-usable 
steps, running various selections of scenarios according to 'tags' and a 
host of other things are large enough that I think you can justify using 
Cukes even if you don't have full buy in at the collaboration tool level. 
 However, if you do that, IMHO you really need to work hard to avoid some 
of the traps mentioned in the link above.  I can go on at some length about 
that, but that would be a thread-jacking, so I will reframe. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Is it possible that slow internet connection can affect an automation testing?

2015-02-16 Thread Chuck van der Linden


On Monday, February 16, 2015 at 9:53:41 PM UTC-8, Ping-0t wrote:
>
> Hello again Guys..
>
>  I was wondering because yesterday I run my codes successfully but when I 
> execute this code today, It gives me an error[pasted below]. And as far as 
> I remember I didn't touch my codes because I copied one for a backup. And I 
> keep on executing this code since this morning it doesn't run successful. 
> We have slow internet connection today, does it affect the automation 
> testing?
>
> Thanks a lot!
>
>
> 
>
 

>   1) Error:
> Login#test_in:
> Timeout::Error: Timeout::Error
> c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
> c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
> c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
> c:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1320:in `block in 
> transport_request'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:in `request'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:in `start'
> c:/Ruby193/lib/ruby/1.9.1/net/http.rb:1285:in `request'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/remote/http/default.rb:83:in `response_for'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/remote/http/default.rb:39:in `request'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/remote/http/common.rb:40:in `call'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/remote/bridge.rb:640:in `raw_execute'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/remote/bridge.rb:618:in `execute'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/remote/bridge.rb:112:in `get'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/w
> ebdriver/common/navigation.rb:14:in `to'
> 
> c:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.11/lib/watir-webdriv
> er/browser.rb:77:in `goto'
> revised_login.rb:14:in `test_in'
>
> 1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
>
> User1@DOCUMENTATIONS /c/testing
> $
>

Yes that sort of error looks typical of the browser being unable to load 
the requested page.  Look on line 14 of your script, it's likely a .goto 
method, and the fault would tend to indicate that page did not load.

If your framework allows you to take specific actions on failures, you 
might want to take a screenshot at that point, which can assist in 
troubleshooting.  That's really easy to do with Cucumber for example.  I 
would presume Minitest has some similar capability, to have specific code 
you execute when there is an error, but not having used it I can't tell you 
how to do that off the top of my head. . 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Ruby Watir to get specific html element of a page

2015-02-16 Thread Chuck van der Linden
On Monday, February 16, 2015 at 10:31:04 PM UTC-8, Nice Faith wrote:
>
> Hai Guys. I am just trying to explore or learn Watir.
> I have already try this one:
>
> puts browser.text
> and it works. I would like to ask if it is possible to display or print 
> only the specific element or html tags.
> For example this one:
>
> Add New User
> Is there any way to get this element only? Not the whole Page source.
>
>
puts browser.button(:data_role => 'add').text

or

puts browser.button(:class => 'btn btn-add').text 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Need to to scroll to bottom of list so remainder of items display and watir-webdriver can interact with them

2015-02-16 Thread Chuck van der Linden
See this answer  to a recent SO 
posting by someone with a similar issue.  I was able to scroll an example 
of that control by using .drag_and_drop_by on the div with the 
'slimScrollBox' class

On Monday, June 9, 2014 at 12:00:28 PM UTC-7, Joe Fl wrote:
>
> Hi everyone,
>
> It was the object i was using.  I needed to use this object 
>
> 
>
> and it is working now.  I would still welcome hearing about how others 
> doing to handle this problem.
>
> Thank you,
>
> Joe
>
>
>
>
> On Monday, June 9, 2014 1:30:31 PM UTC-4, Joe Fl wrote:
>>
>> Hi,
>>
>> I have div that has a number of checkboxes that display columns in a grid 
>> to the right.  The problem is watir-webdriver can not see the one not show 
>> in the browser and i need to use those.
>>
>> I have the following method but it is not working as i would expect.  I 
>> have tried 'slimScrollBar' and it does not work for me.
>>
>>
>> def scroll_to_bottom_list
>>
>>   div_with_scroll = @browser.div(:class => 'slimScrollDiv')
>>
>>   
>> div_with_scroll.elements.last.li.location_once_scrolled_into_view
>>
>>  end
>>
>>
>> HTML code:
>> 
>>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>
>> 
>>
>>
>> I have googled quite a bit but haven't been able to find a solutions. 
>>  Are there other ways to scroll to an item so all the item are visible to 
>> watir-webdriver?
>>
>> Any help would be greatly appreciated.
>>
>> Thank you,
>> Joe
>>
>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] If else not working

2015-02-16 Thread Chuck van der Linden
What error?  I see a warning, but no error.

Of course your script tests nothing, there are no validations in the script, no 
assertions.  Just an if statement which itself really has no condition because 
nothing is being checked.  Your if amounts to ' if object' where your object is 
a textfield.  You could just about as well say " if 'fred' "

You need some kind of conditional, like asking if the text_field exists, or if 
the value of the text field matches some expected value.

Better yet, since you are trying to use minutest, learn how to do assertions 
and use that, and let minutest keep track of passes and failures.

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: Watir responds very slowly for a big line of code

2014-01-21 Thread Chuck van der Linden
On Thursday, January 9, 2014 3:52:53 PM UTC-8, Sanjeev Singh wrote:
>
> This is so nice of you Chuck. This really worked. Both the codes to click 
> on the button also worked.
>
> Just one thing I am unsure about is the behavior of the Firefox browser. 
> When I run the below 3 lines of code, I get the below(image). They are 
> supposed to be like the second image. But this issue did not happen in IE.
> The difference between the 2 images is that in the second image I can 
> click on any of the 2 searched results to navigate to the next screen. But 
> both the results in the 1st image is not clickable.
>
>
> 
>
>
> 
>
>
> Thank you so much again...!!! Really appreciate your time.
>
>
That sounds like you might have browser compatibility issues,  very little 
that watir could do would cause something that is supposed to be clickable 
to not be clickable.  that is more likely a failure on the server or client 
side javascript to function properly when it created that part of the page. 

On Thursday, January 9, 2014 12:10:40 AM UTC-5, Sanjeev Singh wrote:
>>
>> Hi All,
>>
>> I am trying the below code and it is really really slow to respond
>>
>> browser.div(:id => "context-wrapper").frame(:id => 
>> "ConcertoContext").div(:id => "cpo-folder").div(:class => 
>> "cpo-content-wrapper").div(:class => "cpo-content").frame(:id => 
>> "application-content").frame(:name => "SearchFilter").div(:class => 
>> "dt-filter filter").form(:id => "filterForm").text_field(:id => 
>> "attribute.Name-given").set "DEMO"
>> browser.div(:id => "context-wrapper").frame(:id => 
>> "ConcertoContext").div(:id => "cpo-folder").div(:class => 
>> "cpo-content-wrapper").div(:class => "cpo-content").frame(:id => 
>> "application-content").frame(:name => "SearchFilter").div(:class => 
>> "dt-filter filter").form(:id => "filterForm").text_field(:id => 
>> "attribute.Name-surname").set "HIEONE"
>> browser.div(:id => "context-wrapper").frame(:id => 
>> "ConcertoContext").div(:id => "cpo-folder").div(:class => 
>> "cpo-content-wrapper").div(:class => "cpo-content").frame(:id => 
>> "application-content").frame(:name => "SearchFilter").div(:class => 
>> "dt-filter filter").div(:class => "actions").span(:id => 
>> "default-button").span(:class => "first-child").button(:id => 
>> "default-button-button").click
>>
>> All of the above 3 lines of code takes 3-4 minutes each to execute and by 
>> the time the last line gets executed the browser session expires.
>> Please help me if there is any quicker way to find out the last object 
>> and set the values.
>>
>> Thanks in advance...!!! 
>>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [wtr-general] Watir responds very slowly for a big line of code

2014-01-09 Thread Chuck van der Linden
On Thursday, January 9, 2014 4:56:44 AM UTC-8, Oscar.Rieken wrote:
>
> you dont need all of that to locate those elements by their id. you can 
> probably get away with just switching to the you need frame once and then 
> performing the actions. on that frame. you are pretty much traversing the 
> dom to find your element
>
> Building on what oscar suggests  (aka how to recover from brain damage 
caused by tools that use fully qualified xpath for everything)

search_filter_frame =  browser.frame(:id => "ConcertoContext").frame(:id => 
"application-content").frame(:name => "SearchFilter")
search_filter_frame.text_field(:id => "attribute.Name-given").set "DEMO"
search_filter_frame..text_field(:id => "attribute.Name-surname").set 
"HIEONE"
search_filter_frame..button(:id => "default-button-button").click

Now, my gut tells me that the last bit will fail, or click the wrong button 
because well, any page with that many frames is just pure evil dinosaur web 
1.0 crap.  Such a page is thus bound to completely ignore HTML standards 
such as *ID values must be unique within a page (or frame)*, so there could 
likely a plethora of buttons on that form inside the 'default-button' span 
(for various options other than first child) all with the very same ID 
value.  If my gut is wrong, count your blessings, although with all those 
frames there will not be many.  If my gut is right, then after you have 
bugged the page for violating HTML standards, you can try this instead

search_filter_frame.span(:class => "first-child").button(:id => 
"default-button-button").click  #or as much container info is needed to 
find the right button.

--Chuck  (yes, I hate frames, however did you guess?) vdL

On Thu, Jan 9, 2014 at 12:10 AM, Sanjeev Singh 
> > wrote:
>
>> Hi All,
>>
>> I am trying the below code and it is really really slow to respond
>>
>> browser.div(:id => "context-wrapper").frame(:id => 
>> "ConcertoContext").div(:id => "cpo-folder").div(:class => 
>> "cpo-content-wrapper").div(:class => "cpo-content").frame(:id => 
>> "application-content").frame(:name => "SearchFilter").div(:class => 
>> "dt-filter filter").form(:id => "filterForm").text_field(:id => 
>> "attribute.Name-given").set "DEMO"
>> browser.div(:id => "context-wrapper").frame(:id => 
>> "ConcertoContext").div(:id => "cpo-folder").div(:class => 
>> "cpo-content-wrapper").div(:class => "cpo-content").frame(:id => 
>> "application-content").frame(:name => "SearchFilter").div(:class => 
>> "dt-filter filter").form(:id => "filterForm").text_field(:id => 
>> "attribute.Name-surname").set "HIEONE"
>> browser.div(:id => "context-wrapper").frame(:id => 
>> "ConcertoContext").div(:id => "cpo-folder").div(:class => 
>> "cpo-content-wrapper").div(:class => "cpo-content").frame(:id => 
>> "application-content").frame(:name => "SearchFilter").div(:class => 
>> "dt-filter filter").div(:class => "actions").span(:id => 
>> "default-button").span(:class => "first-child").button(:id => 
>> "default-button-button").click
>>
>> All of the above 3 lines of code takes 3-4 minutes each to execute and by 
>> the time the last line gets executed the browser session expires.
>> Please help me if there is any quicker way to find out the last object 
>> and set the values.
>>
>> Thanks in advance...!!! 
>>
>> -- 
>> -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-...@googlegroups.com 
>> http://groups.google.com/group/watir-general
>> watir-genera...@googlegroups.com 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Watir General" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to watir-genera...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: How to test infinite scrolling on web page

2014-01-08 Thread Chuck van der Linden
On Friday, December 20, 2013 1:53:20 AM UTC-8, Anisha wrote:
>
> Hi,
>
> I am using watir-webdriver. The application that I am testing has infinite 
> scrolling implemented. It is more or less like 1000 results present but 
> dis[played 10 at a time and next 10 results appear on scrolling the page, 
> so how do I test if infinite scrolling works or not on my web application.
> I tried the following code:
> @browser.execute_script("window.scrollTo(0,1500)")
> sleep 5
>
> But I do not see any movement on the browser. And also, how do I assert 
> that infinite scrolling is working properly.
>
> -- 
> Regards,
> Anisha Narang
>

This kind of thing is generally event driven, so find out what event is 
being issued by the browser when the page is scrolled down within x of the 
bottom,

count number or results by counting number of an unique element that exists 
in each result (usually in a header for the result)
fire the event that triggers the next segment load
wait for whatever loading indicator they display to go away
count number of results and see if it went up by the expected amount.

that the event fires is almost like testing the browser


-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: Major delay with watir script execution. Possible newbie error.

2014-01-08 Thread Chuck van der Linden
On Sunday, December 29, 2013 11:36:23 PM UTC-8, Colin Milyoni wrote:
>
> Hi folks,
>
> I'm new to both ruby and to watir, so I apologize in advance if this is a 
> massive rookie mistake. Assistance of any level is greatly appreciated.
>
> My problem is that I am running into a gigantic delay when executing a 
> simple watir script. This is the first time that I've run into such a large 
> delay.
>
> The point of the script is to go into Facebook's Developers section, open 
> an app, then individually remove test users from the app by clicking on a 
> checkbox which corresponds to a table row, then clicking a button on the 
> page which initiates a delete action, confirming the delete, then closing 
> the window.  As you can see, I have a while-loop which will end the script 
> once the table has been thinned to only 11.
>
> Here is the code itself:
>
> require 'watir-webdriver'
> b = Watir::Browser.new :chrome
>
>
> b.goto "http://www.facebook.com";
> b.text_field(:name=> "email").set "x"
> b.text_field(:name=> "pass").set "xx"
> b.input(:value=>"Log In").click
>
> b.goto "
> https://developers.facebook.com/apps/1423456271203959/roles?role=test+users
> "
>
> rows = b.elements(:class=>"odd").size
>
> while rows > 10
> b.tr
> (:id =>/test_user/, :index => 10).checkbox(:type =>"checkbox").set
> b.input(:type =>"submit", :value=>"Remove").click
> sleep 1
> b.input(:type =>"button", :value=>"Remove").click
> sleep 1
>
> sleep 2
> b.input(:type =>"button", :value=>"Close").click
> end
>
> puts "Purge completed!"
>
>
> After running the code line-by-line in IRB, I am able to conclusively 
> isolate the issue to this line of code:
>
> b.tr(:id =>/test_user/, :index => 10).checkbox(:type =>"checkbox").set
>
> You can see how long it takes this line to execute by viewing the attached 
> swf file called "Remove problem_with_selecting_ID_12-29-13.swf"
>
> When this line of code runs, the script takes 30-60 seconds just to run 
> that single line of code.  Apparently that method is a little too complex, 
> but I'm not sure exactly why that is.  Would anyone be able to explain to 
> me what the problem is exactly?  My hunch is that the way that it is 
> parsing the DOM for that method is very inefficient.  I'm sure there is 
> another way I could write my code but I would most be interesting in being 
> pointed to a resource which explains why it is that this is so inefficient. 
> I'd really appreciate that.
>
> Thanks,
>
> Colin
>

I don't know the technical reason, but it does seem that once you get 
inside a table, things can be very slow.

as an alternative (although the suggestion to use the FB API is superior) 
you could try building a collection of rows, check that the size is above 
11, and if so have it iterate over the first size-11 elements in the row 
collection setting the checkbox

user_rows = b.trs(:class => 'odd')
if rows.size > 10
  10..rows.size-1 do |i|
rows[i].checkbox(:type =>"checkbox").set
  end
  b.input(:type =>"submit", :value=>"Remove").click
  sleep 1
  b.input(:type =>"button", :value=>"Remove").click
  sleep3
b.input(:type =>"button", :value=>"Close").click
end

or something along those lines (I'm making some assumptions about their UI 
that you can check multiple boxen and then purge all at once

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: test is taking a long time in webdriver v classic

2014-01-08 Thread Chuck van der Linden
With the way you have things, I think it is having to relocate the row and 
cells each time it goes through the loop

While it does not answer the slowness question, maybe it would be faster to 
build a collection of cells for each of the proper rows, (so that is done 
once) and then work directly with those collections (so you iterate within 
the collection you've already built) 

Did I phrase that in a way that makes sense? 



On Monday, December 30, 2013 1:52:40 PM UTC-8, hillary wrote:
>
> That might be what's causing the slow down. I'm just not sure how to speed 
> up the test, because i do have to check each td to see that it has the 
> correct setting. 
>
> On Tuesday, December 24, 2013 12:49:26 AM UTC-8, Jarmo Pertman wrote:
>>
>> I have also noticed that as soon as you go down to table's row and cell 
>> levels (e.g using #td and #tr methods) then it becomes really, really, 
>> reaay slow when using webdriver. Not sure about the reason though.
>>
>> Maybe Jari can comment on that?
>>
>> Jarmo Pertman
>> -
>> IT does really matter - http://itreallymatters.net
>>
>>
>> On Tuesday, December 24, 2013 1:46:01 AM UTC+2, hillary wrote:
>>>
>>> I have a test that takes upwards of 15 minutes or more to complete when 
>>> running it in webdriver(ie, firefox, chrom) v classic for ie (which takes 
>>> 35s). I'm using taza with turnip as the test framework, running on windows 
>>> 7x64 bit with ruby 2.0. 
>>>
>>> Most of the test runs at a fine speed, but the step of the test that 
>>> bogs everything down is this loop 
>>>
>>> (1..slots).each do |s|
>>>   @site.slotting.slot_title(@variant_id, s).text.should eq s.to_s
>>>   @site.slotting.slot_checkmark(@variant_id, s).should exist
>>> end
>>>
>>>
>>> This is how i defined those elements: 
>>> element(:slot_title) {|variant_id,index| browser.div(:id, 
>>> "grid_Variant_#{variant_id}").div(:id, "cpsess-#{variant_id}").
>>> table.tr.td(:index, 5).table.tr.td(:index, index).div(:index, 0)}
>>> element(:slot_checkmark) {|variant_id,index| browser.div(:id, 
>>> "grid_Variant_#{variant_id}").div(:id, "cpsess-#{variant_id}").
>>> table.tr.td(:index, 5).table.tr.td(:index, index).div(:index, 
>>> 1).image(:src, /checkmark.png/)}
>>>
>>> I currently have to use indexes because it is not fesable to ask for ids 
>>> for each tr/td element at this time. 
>>>
>>>
>>> So i'm wondering two things: 
>>>
>>>1. Why is the following loop significantly slower in 
>>>watir-webdriver? 
>>>2. Is there a better way to write this validation. I'm trying to 
>>>validate that all of the Columns in the highlighted section of the 
>>> attached 
>>>screenshot have a checkmark underneath the number. 
>>>
>>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: Logging HTTP traffic via a proxy while running webdriver tests?

2014-01-08 Thread Chuck van der Linden
On Wednesday, January 8, 2014 9:38:15 AM UTC-8, Dan wrote:
>
> Actually, I was confusing some work I've done with wireshark and fiddler. 
>  Wireshark has a command line interface that I've used.  This was actually 
> done in a powershell script and not ruby, but it's the same idea. 
>  Wireshark might be a little too low level though? 
>
> You can pass the interface you want to monitor and filters and such.
>
> c:\Program Files\Wireshark\Wireshark"  -i Wi-Fi -k -w  $($path)
>
> http://www.wireshark.org/docs/wsug_html_chunked/ChCustCommandLine.html
>
> Looks like in ubuntu you can get it from the software center and probably 
> do something very similar via ruby.
>

When you use wireshark did you need to do anything special when starting 
the browser?  (like telling it to use a proxy) or does it work more like a 
network monitor tool that just watches the traffic? 

 

>
> On Wednesday, January 8, 2014 12:09:26 PM UTC-5, Chuck van der Linden 
> wrote:
>>
>>
>>
>> On Tuesday, January 7, 2014 12:06:55 PM UTC-8, Dan wrote:
>>>
>>> I've "cheated" in the sense that I've used Fiddler by programmatically 
>>> starting and stopping it when running tests.  There looks to be a Linux 
>>> build of it now.  In my case it was ADFS so I feel your pain.
>>>
>>> http://fiddler.wikidot.com/mono<http://www.google.com/url?q=http%3A%2F%2Ffiddler.wikidot.com%2Fmono&sa=D&sntz=1&usg=AFQjCNHGL32pXhWZezicvDlNfw8nXkFKag>
>>>
>>
>> If it gets me a usable HTTP log, I'm not sure I would call it cheating. 
>>  I wonder if there is a standard package to install fiddler on the Saucy 
>> version of ubuntu, I'd need that to be able to install it on the container. 
>>  google is not finding me one, so I may be SOL in terms of this approach
>>
>> How did you tell the firefox browser instance to use the system proxy 
>> when you did Watir::Browser.new?  The stuff at the site you referenced 
>> tells me how to do it manually, but obviously that's not going to work.
>>
>> If you have code you could share, that would be wonderful and save me a 
>> lot of trial and error
>>
>>
>>>
>>> On Tuesday, January 7, 2014 2:31:45 PM UTC-5, Chuck van der Linden wrote:
>>>>
>>>> This stackoverflow is very similar, and has no answer so far  
>>>> http://stackoverflow.com/questions/19178901/integrate-watir-webdriver-and-browsermob-proxy-and-webdriver-user-agent
>>>>
>>>> I've got some web pages being very flakey and inconsistent (an SSO 
>>>> solution based on shibbolith) and we really need to be able to generate a 
>>>> http traffic log of what happens while the tests are running.
>>>>
>>>> Tests run in a unix container
>>>>
>>>> Looking around it seems like something such as BrowserMob/proxy might 
>>>> work well, and there is even a  browsermob-proxy gem written by this 
>>>> 'jarib' guy who I think may know something about watir-webdriver also 
>>>>  (wink wink) 
>>>>
>>>> It seems like it ought to be possible to use watir-webdriver and 
>>>> browsermob-proxy together to do what is needed to be able to create a 
>>>> proxy 
>>>> logfile of a session of watir tests, but I'm a little at a loss of where 
>>>> to 
>>>> start.The browsermob readme gives an example for webdriver, but not 
>>>> for 
>>>> watir-webdriver.
>>>>
>>>> can anyone tell me how I'd go about using browsermob-proxy with 
>>>> watir-webdriver? 
>>>>
>>>> --Chuck vdL  (posting from the work email since this is work related) 
>>>>
>>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: test coverage

2014-01-08 Thread Chuck van der Linden
sure, monitor the server code with some kind of coverage tool while the 
tests execute.

please note that 'code coverage' is a terrible metric for anything to do 
with the quality of your testing.  It is for example entirely possible to 
write 'tests' that will never detect a single error or problem, but provide 
100% code coverage, accomplishing nothing but wasting time developing them 
and providing management obsessed with 'code coverage' with a false sense 
of security.


On Wednesday, January 8, 2014 8:33:00 AM UTC-8, L.M.E wrote:
>
> Hello,
>
> Is there a way to know the test coverage for the code we are testing using 
> Watri?
>
> Many thanks,
>
> L.M.E
>
>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: NoMethodError: undefined method 'show_all_objects' for #

2014-01-08 Thread Chuck van der Linden
On Tuesday, January 7, 2014 10:48:45 PM UTC-8, Sanjeev Singh wrote:
>
> Hi All,
>
> I am getting the below error when I type the below code
> irb
> require "watir"
> ie = Watir::Browser.new :ie
> ie.goto "http://www.google.com";
> #till this point it works fine
>
> ie.show_all_objects gives the error "NoMethodError: undefined method 
> 'show_all_objects' for #
> Any help on this will be greatly appreciated.
>
>
> thanks..!!
>

The error means just what it says, the method you are trying to call is not 
defined, in other words you are trying to invoke a method that does not 
exist.

What is it that you are trying to do/accomplish? 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: problem with using watir and win32ole together

2014-01-08 Thread Chuck van der Linden
On Monday, January 6, 2014 2:26:22 AM UTC-8, marcwest...@gmail.com wrote:
>
> I am using watir to automate a browser application which has modal 
> dialogs, but i also use excel to drive what automated tests are run.
>  
> The problem I have is when I add the statement require 'win32ole' into my 
> script this then causes errors when I try and deal with a modal dialog. 
> When I take the require 'win32ole statement out it works fine.
>  
> The error I get when require 'win32ole' is present and try and deal with a 
> modal dialog is this
>  
> C:/Ruby2_0_0/lib/ruby/gems/2.0.0/gems/watir-classic-4.0.1/lib/watir-classic/modal_dialog.rb:59:in
>  
> `locate': undefined method `connect_unknown' for WIN32OLE:Class 
> (NoMethodError)from 
> C:/Ruby2_0_0/lib/ruby/gems/2.0.0/gems/watir-classic-4.0.1/lib/watir-classic/modal_dialog.rb:15:in
>  
> `title'
>  
>  
> When I remove the require 'win32ole' the above error does not happen.
>  
>  
> Has anyone come across this problem and if so how do I over come it ?
>

What order are your require statements in?

Can you do 'gem list' from the command line and give us the versions of 
applicable gems?

Are you using bundler? 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: Logging HTTP traffic via a proxy while running webdriver tests?

2014-01-08 Thread Chuck van der Linden


On Tuesday, January 7, 2014 12:06:55 PM UTC-8, Dan wrote:
>
> I've "cheated" in the sense that I've used Fiddler by programmatically 
> starting and stopping it when running tests.  There looks to be a Linux 
> build of it now.  In my case it was ADFS so I feel your pain.
>
> http://fiddler.wikidot.com/mono<http://www.google.com/url?q=http%3A%2F%2Ffiddler.wikidot.com%2Fmono&sa=D&sntz=1&usg=AFQjCNHGL32pXhWZezicvDlNfw8nXkFKag>
>

If it gets me a usable HTTP log, I'm not sure I would call it cheating.  I 
wonder if there is a standard package to install fiddler on the Saucy 
version of ubuntu, I'd need that to be able to install it on the container. 
 google is not finding me one, so I may be SOL in terms of this approach

How did you tell the firefox browser instance to use the system proxy when 
you did Watir::Browser.new?  The stuff at the site you referenced tells me 
how to do it manually, but obviously that's not going to work.

If you have code you could share, that would be wonderful and save me a lot 
of trial and error


>
> On Tuesday, January 7, 2014 2:31:45 PM UTC-5, Chuck van der Linden wrote:
>>
>> This stackoverflow is very similar, and has no answer so far  
>> http://stackoverflow.com/questions/19178901/integrate-watir-webdriver-and-browsermob-proxy-and-webdriver-user-agent
>>
>> I've got some web pages being very flakey and inconsistent (an SSO 
>> solution based on shibbolith) and we really need to be able to generate a 
>> http traffic log of what happens while the tests are running.
>>
>> Tests run in a unix container
>>
>> Looking around it seems like something such as BrowserMob/proxy might 
>> work well, and there is even a  browsermob-proxy gem written by this 
>> 'jarib' guy who I think may know something about watir-webdriver also 
>>  (wink wink) 
>>
>> It seems like it ought to be possible to use watir-webdriver and 
>> browsermob-proxy together to do what is needed to be able to create a proxy 
>> logfile of a session of watir tests, but I'm a little at a loss of where to 
>> start.The browsermob readme gives an example for webdriver, but not for 
>> watir-webdriver.
>>
>> can anyone tell me how I'd go about using browsermob-proxy with 
>> watir-webdriver? 
>>
>> --Chuck vdL  (posting from the work email since this is work related) 
>>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: problems with watir and win32ole

2014-01-08 Thread Chuck van der Linden
On Monday, January 6, 2014 6:47:30 AM UTC-8, marcwest...@gmail.com wrote:
>
> I have an issue where when I require 'win32ole' in a script I then get an 
> error when trying to deal with a modal dialog. When I remove require 
> 'win32ole' the error goes away.
>
> The error I am getting is...
>
> C:/Ruby2_0_0/lib/ruby/gems/2.0.0/gems/watir-classic-4.0.1/lib/watir-classic/modal_dialog.rb:59:in
>  
> `locate': undefined method `connect_unknown' for WIN32OLE:Class 
> (NoMethodError) from 
> C:/Ruby2_0_0/lib/ruby/gems/2.0.0/gems/watir-classic-4.0.1/lib/watir-classic/modal_dialog.rb:15:in
>  
> `title'
>
>
> What order are your require statements in?

Can you do 'gem list' from the command line and give us the gem versions?

Are you using bundler?  

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [wtr-general] Re: watir, watir-webdriver, watir-classic: history and current state?

2014-01-07 Thread Chuck van der Linden
On Monday, December 30, 2013 7:53:06 AM UTC-8, Željko Filipin wrote:
>
> On Wed, Dec 25, 2013 at 6:18 PM, Jarmo Pertman 
> > wrote:
>
>> It's more or less the same.
>
>
> +1
>
> Željko
>

Agreed.

The big differences between the two are

   - Cross browser support 
  - watir has none, as mention above it is IE only (not an issue 'back 
  in the day' when it originated and IE had 90% of the market share)
  - watir-webdriver supports pretty much anything webdriver supports, 
  Firefox, Chrome, IE, Opera, Safari, iOS, Android etc
   - How IE is 'driven'
  - watir-classic uses windows exclusive stuff (pretty old stuff, 
  WIN32OLE? (presuming my memory of that is correct) to drive IE
  - watir-webdriver uses webdriver to drive IE
   
To the extent that watir-webdriver has issues with IE, very likely ANY 
other webdriver based tool, Capybara, Selenium, will have the very same 
issues

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: watir syntax for

2014-01-07 Thread Chuck van der Linden


On Sunday, December 29, 2013 3:55:48 AM UTC-8, Priti Fhuse wrote:
>
> I have been stuck for 2 days in
> this water using testwise tool
>  
> I would like to know what should be the sysntax for  class="LinkClassAvailability"> in watir 
>  
> 2> 2nd question how to use loops in testwise
>

re the second question.  I don't know testwise, but if it is using ruby (as 
Watir-webdriver does) then you would just use normal ruby loops or flow 
control

5.times do
  # stuff to do
end

while (condition_initially_true)  #loops while condition_initially_true 
becomes false
  #stuff to do
end

until (condition_initially_false) #loops until condition_initially_false 
becomes true
 #stuff to do
end

etc

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Logging HTTP traffic via a proxy while running webdriver tests?

2014-01-07 Thread Chuck van der Linden
This stackoverflow is very similar, and has no answer so far 
 
http://stackoverflow.com/questions/19178901/integrate-watir-webdriver-and-browsermob-proxy-and-webdriver-user-agent

I've got some web pages being very flakey and inconsistent (an SSO solution 
based on shibbolith) and we really need to be able to generate a http 
traffic log of what happens while the tests are running.

Tests run in a unix container

Looking around it seems like something such as BrowserMob/proxy might work 
well, and there is even a  browsermob-proxy gem written by this 'jarib' guy 
who I think may know something about watir-webdriver also  (wink wink) 

It seems like it ought to be possible to use watir-webdriver and 
browsermob-proxy together to do what is needed to be able to create a proxy 
logfile of a session of watir tests, but I'm a little at a loss of where to 
start.The browsermob readme gives an example for webdriver, but not for 
watir-webdriver.

can anyone tell me how I'd go about using browsermob-proxy with 
watir-webdriver? 

--Chuck vdL  (posting from the work email since this is work related) 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: After FF update on Ubuntu execute_script is not working

2013-08-07 Thread Chuck van der Linden
strange that after a gem update you are getting errors from the 2.33 
version of webdriver when 2.34 is the latest..

are you using bundler?  if so did you try running 'bundle update' ?

On Wednesday, August 7, 2013 5:25:17 AM UTC-7, Tadeu Panato wrote:
>
> this morning I update the FF (23) in Ubuntu 13 and the execute_Script is 
> not working anymore.
>
> I also to check if a gem update solve the issue update the selenium-driver 
> too
>
>
> I'm getting this error:
>
> Selenium::WebDriver::Error::JavascriptError: waiting for evaluate.js load 
> failed
> [remote server] 
> file:///tmp/webdriver-profile20130807-18517-1b8iazq/extensions/fxdriver @ 
> googlecode.com/components/driver_component.js:8360:in `r'
> [remote server] 
> file:///tmp/webdriver-profile20130807-18517-1b8iazq/extensions/fxdriver @ 
> googlecode.com/components/driver_component.js:392:in`fxdriver.Timer.prototype.runWhenTrue/g'
> [remote server] 
> file:///tmp/webdriver-profile20130807-18517-1b8iazq/extensions/fxdriver @ 
> googlecode.com/components/driver_component.js:386:in`fxdriver.Timer.prototype.setTimeout/<.notify'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:51:in
>  
> `assert_ok'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/response.rb:15:in
>  
> `initialize'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in
>  
> `new'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:59:in
>  
> `create_response'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:66:in
>  
> `request'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in
>  
> `call'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in
>  
> `raw_execute'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in
>  
> `execute'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:328:in
>  
> `executeScript'
> /var/lib/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:213:in
>  
> `execute_script'
> /var/lib/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:259:in
>  
> `execute_script'
>
>
> anyone is getting the same error? in chrome is working
>
> thanks!
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: Click a particular X and Y co-ordinates in the browser pane by using watir webdriver

2013-08-07 Thread Chuck van der Linden
On Thursday, August 1, 2013 10:40:46 PM UTC-7, Srinivas Desai wrote:

> Hi All,
>
> I need to know how can we click on a particular x and y co-ordinates in 
> the browser pane by using watir web driver.
> I already have x,y co-ordinates with me, i just need to click.
> Please let me know how it can be done.
>
> Thanks in advance.
>
> Regards,
> Srinivas.
>
>
using specific x,y coordinates is perhaps one of the best ways to create a 
brittle hard to maintain script.  running the script on a different system 
with different browser size, zoom level, site re-designs, etc  all can 
break the script.

Is there a specific reason you are trying to do things this way?  Normally 
there are far better ways to figure out where to click.  And where those 
don't work there are tools like Sikuli that work visually which are still 
usually a better alternative to a fixed X,Y based action

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [wtr-general] Watir - execute_script fail in FF 23 windows

2013-08-07 Thread Chuck van der Linden
Looks a lot like webdriver can't connect to the browser..  

I think you are right this is a webdriver issue, I'd head to 
the https://groups.google.com/forum/#!forum/selenium-users as a potential 
forum to talk about webdriver level problems.  

On Tuesday, August 6, 2013 1:33:09 PM UTC-7, Tadeu Panato wrote:
>
> running in FF local it not failed
>
> running in ie10i got that:
>
> *Error: test_02_local(TsCheckHome)*
> *  Errno::ECONNREFUSED: No connection could be made because the target 
> machine actively refused it. - connect(2)*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:763:in `initialize'*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:763:in `open'*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:763:in `block in connect'*
> *C:/Ruby193/lib/ruby/1.9.1/timeout.rb:55:in `timeout'*
> *C:/Ruby193/lib/ruby/1.9.1/timeout.rb:100:in `timeout'*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:763:in `connect'*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:756:in `do_start'*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'*
> *C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1285:in `request'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:83:in
>  
> `response_for'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:39:in
>  
> `request'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in
>  
> `call'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in
>  
> `raw_execute'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in
>  
> `execute'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:328:in
>  
> `executeScript'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:213:in
>  
> `execute_script'*
> *C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:259:in
>  
> `execute_script'*
> *test.rb:743:in `block in buy_product'*
> *C:/Ruby193/lib/ruby/1.9.1/timeout.rb:69:in `timeout'*
>
> and its always in the same part of the test.
>
> any clue? or i need study more.
> any blame are welcome.
>
>
> Em terça-feira, 6 de agosto de 2013 08h52min08s UTC-3, Tadeu Panato 
> escreveu:
>>
>> Yes Filipin
>>
>> They told to me to check the forum =/
>>
>> I will setup a local windows to check and will publish here the results.
>>
>> thanks
>>
>> Em terça-feira, 6 de agosto de 2013 07h38min33s UTC-3, Željko Filipin 
>> escreveu:
>>>
>>> On Fri, Aug 2, 2013 at 11:29 PM, Tadeu Panato  wrote:
>>>
 In FF 23 on Linux it works however in FF 23 on Win 7 didnt work (using 
 saucelabs)
>>>
>>>
>>> It could be a Firefox+Windows problem then, or Sauce Labs problem. Did 
>>> you contact Sauce Labs support?
>>>
>>> Željko
>>> --
>>> https://leanpub.com/watirbook
>>>  
>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[wtr-general] Re: I would love to say to watir to use hidemyass vpn pro

2013-08-07 Thread Chuck van der Linden
On Tuesday, August 6, 2013 8:50:53 AM UTC-7, dada wrote:

> I would love to say to watir to use hidemyass vpn pro and connect for that 
> test to particulair country.
> I searched and found that can be done with proxy, but cant find working 
> version, can someone give me some working examples.
>
> regards
> daka
>

I think we need a better idea what you are trying to accomplish.  Watir 
works by driving a web browser, usually located on the same system that is 
executing the script code.  The browser then connects to the web site, 
which could be your local system, or a test env, or a site on the internet.

  [your-box {watir} ==> {browser} ==> {OS IP stack}] ==> LAN ==> internet 
==> [webserver]

How the browser connects to the test site is really outside of what watir 
is doing.  If you are adding VPN or a proxy(server), that's happening where 
you see the IP stack or LAN in the little diagram above.  Presuming it is 
properly configured, the test script you would run would be exactly the 
same as if you were connecting to the site via a normal network.  If you 
can connect the browser to the site and surf manually, then you should be 
able to drive the browser via watir 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [wtr-general] Project Structure for cucumber+watir

2013-08-07 Thread Chuck van der Linden


On Monday, August 5, 2013 11:06:11 AM UTC-7, Chuck van der Linden wrote:
>
> On Wednesday, July 3, 2013 12:36:16 AM UTC-7, Željko Filipin wrote:
>
>> On Wed, Jul 3, 2013 at 8:08 AM, Vincy C  wrote:
>>
>>> Can anyone tell me the project structure for cucumber+watir project in 
>>> Net beans IDE
>>
>>
>> You can structure the project how ever you want. Read this book if you 
>> want to learn how to structure the code in a good way:
>>
>> https://leanpub.com/cucumber_and_cheese
>>
>> Željko
>> --
>> https://leanpub.com/watirbook 
>>
>
> Mine looks like this.  I'm using the Test-Factory page and data object gem 
>  (it's a bit lighter weight that Cheesey's and supports only 
> Watir-webdriver, so can be a bit more optimized for watir users, compared 
> to one that supports watir-webdriver and selenium-webdriver)
>
>
> <https://lh5.googleusercontent.com/-_86AbnEEZXU/Uf_pdIvR-NI/AEw/K3p83cTZaDw/s1600/cuke-project-layout.png>
>
> btw  in that particular example, the main reason you see two pages under 
lib, is that they are 'base' pages which contain common elements the other 
pages depend on.  Having them there makes it easier to load them first 
automatically without having to call each out by name.  That's done with 
code like this in env.rb

require 'test-factory'
World Foundry
World StringFactory
World DateFactory

#  our lib directory, where we keep page_objects, data_objects, and other 
test helper methods
$: << File.dirname(__FILE__)+'/../../lib'

#require the definitions for page and data objects
Dir["#{File.dirname(__FILE__)}/../../lib/*.rb"].each {|f| require f }
Dir["#{File.dirname(__FILE__)}/../../lib/page_objects/*.rb"].each {|f| 
require f }
Dir["#{File.dirname(__FILE__)}/../../lib/data_objects/*.rb"].each {|f| 
require f }

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [wtr-general] Anyone else having trouble with latest chromedriver for mac?

2013-08-07 Thread Chuck van der Linden
On Tuesday, August 6, 2013 2:56:32 AM UTC-7, Željko Filipin wrote:

> On Sat, Aug 3, 2013 at 12:15 AM, Chuck van der Linden <
> cvande...@climate.com > wrote:
>
>> Is anyone else that tends to work with a mac and Chrome having problems 
>> with the latest chromedriver?  after installing it all my scripts started 
>> failing.
>
>
> Sounds like a bug in chromedriver to me. Did you report it in their bug 
> tracker?
>
> Željko
> --
> https://leanpub.com/watirbook
>

Found someone else reporting a similar error.  tried to produce a simple 
script to reproduce the problem but it would NOT fail.. but the scripts 
would..

Long story short, I'm using bundler and it had an older version of 
webdriver in the gemfile.lock  The problem was I think that updates to 
chromedriver required a newer version of webdriver, and my system was 
pulling in an older webdriver due to bundler.

Ran 'bundle update' and the weird 404 errors have gone away (note that they 
seem to have been related to using .exists? or .when_present) 

Moral of the story, when using bundler, remember to use bundle update, not 
just gem update. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: Help with ul class values

2013-08-05 Thread Chuck van der Linden
On Saturday, June 29, 2013 10:29:28 AM UTC-7, Fred Cassirer wrote:

> Hi,
>
> I have some page source that looks like:
>
>data-battery-level="5.71535">1 
>1 class="green">11  
> 
>
>
> I'm trying to get the value of 'data-battery-level' ...
>
>
> I have tried a number of different things, but I can't seem to find how to 
> pick out the value.
>
>
> b = Watir:Browser.new
>
> ...
>
> d = b.div :class => 'battery'
>
> d.text
>
> => "1\n1\n1\n1"
>
> >> d.ul
> => #"ul"}>
>
> >> d.elements
> => # @parent=# selector={:class=>"battery", :tag_name=>"div"}>>
> >> b.div(:class,"battery").li(:index,2).text
> => "1"
> >> b.div(:class,"battery-level-list")
> => # selector={:class=>"battery-level-list", :tag_name=>"div"}>
>
> I'm stumped ...
>
> Thanks in advance for any insight
> -Fred
>

The div is just an outer container, the ul (unordered list) tag inside the 
div is what has the attribute you want to get.  So you want to do something 
like

   b.ul(:class => 
"battery-level-list").attribute_value("data-battery-level") 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [wtr-general] Project Structure for cucumber+watir

2013-08-05 Thread Chuck van der Linden
On Wednesday, July 3, 2013 12:36:16 AM UTC-7, Željko Filipin wrote:

> On Wed, Jul 3, 2013 at 8:08 AM, Vincy C  >wrote:
>
>> Can anyone tell me the project structure for cucumber+watir project in 
>> Net beans IDE
>
>
> You can structure the project how ever you want. Read this book if you 
> want to learn how to structure the code in a good way:
>
> https://leanpub.com/cucumber_and_cheese
>
> Željko
> --
> https://leanpub.com/watirbook 
>

Mine looks like this.  I'm using the Test-Factory page and data object gem 
 (it's a bit lighter weight that Cheesey's and supports only 
Watir-webdriver, so can be a bit more optimized for watir users, compared 
to one that supports watir-webdriver and selenium-webdriver)



-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [wtr-general] [Watir-webdriver] - Drag and drop using watir webdriver

2013-08-05 Thread Chuck van der Linden
On Sunday, July 14, 2013 8:29:45 AM UTC-7, watir webdriver wrote:

> Thanks for the reply John...I've managed to fix the issue.


So for the benefit of anyone else who is trying to do this sort of thing, 
would you care to share with us HOW you managed to fix the issue, e.g. the 
code that is working to do what you wanted?

 

>
>
> On Wednesday, July 10, 2013, John Fitisoff wrote:
>
>> A couple of seconds seems like a long time. Maybe try the action builder 
>> 'release' action instead of firing the event? Maybe some javascript event 
>> isn't occurring at the right time? One thing that really helps me is to use 
>> pry to stop the test right at the point that the problem is occurring 
>> (maybe you're already doing something like that). Then it's a lot easier to 
>> see what's going on. You can just install pry and then insert binding.pry 
>> at the point where you want the test to halt. Then type exit to continue 
>> execution. 
>>
>>
>>   --
>>  *From:* watir webdriver 
>> *To:* watir-general@googlegroups.com 
>> *Sent:* Wednesday, July 10, 2013 3:43 AM
>> *Subject:* [wtr-general] Re: [Watir-webdriver] - Drag and drop using 
>> watir webdriver
>>  
>> Thanks for your reply...with this code I can see the drag and drop but 
>> after couple of seconds the dropped element is getting disappeared...but 
>> the scenario is passed successfully...Although it didn't work as expected 
>> when I checked manually by visiting the webpage.Any one can help me with 
>> this ?
>>
>> my_element = @browser.span(:text => "Abandoned Basket")
>> target = @browser.div(:class => "droparea ui-droppable ui-sortable")
>> target = @browser.div(:id => "0")
>> my_element.fire_event("onmousedown")
>> @browser.driver.action.click_and_hold(my_element.wd).perform
>> sleep 15
>> @browser.driver.action.move_to(target.wd).perform
>> sleep 15
>> my_element.fire_event("onmouseup")
>> end
>>
>> Your help is much more appreciated.
>>
>>
>> On Wednesday, July 3, 2013 2:53:28 PM UTC+1, watir webdriver wrote:
>>
>> Hi there,
>>
>> I'm trying to drag and drop an element in webpage through the below code:
>>
>> Step def:
>> When(/^I drag and drop Basket rule to the position slot$/) do
>> @browser.span(:class => "draggable ui-draggable").drag_and_drop_ 
>> on(@browser.div(:class => "droparea ui-droppable ui-sortable"))
>> end
>>
>> *The scenario is passing but on the webpage its just high lighting the 
>> draggable element.*(drop is not working)
>>
>> *HTML code for draggable code*:
>> 
>> 
>>  Basket
>> 
>> 
>> 
>>
>>
>> *HTML code for droppable code:*
>> 
>>
>> Anyone can help me with this issue ?
>>
>> Thanks in-advance.
>>
>>
>> -- 
>> -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-general@googlegroups.com
>> http://groups.google.com/group/watir-general
>> watir-general+unsubscr...@googlegroups.com
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Watir General" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to watir-general+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>>
>>   -- 
>> -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-general@googlegroups.com
>> http://groups.google.com/group/watir-general
>> watir-general+unsubscr...@googlegroups.com
>>  
>> --- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "Watir General" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/watir-general/mrHJU9iGIqI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> watir-general+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [wtr-general] Cannot open excel

2013-08-05 Thread Chuck van der Linden


On Monday, August 5, 2013 9:24:22 AM UTC-7, Oscar.Rieken wrote:
>
> 1. Don't try to automate against gmail there a bunch of posts explaining 
> why. I'll just say it changes a lot. you never really know what you are 
> getting.
> 2. Opening an Excel document has nothing to do with watir.
>
> for the roo problem I would suspect their mailing list would be a better 
> place to ask the question.
>

See here for a basic readme on using roo http://roo.rubyforge.org/

It looks like you are using an older syntax, perhaps from an example that 
needs to be updated.  the new syntaxt is 

mysheet = Excel.new(filename)

For more help than that, see a roo forum/group as Oscar suggests.  

Oscar's point about not automating against the gmail UI is right on. Unless 
you are working for Google and trying to do automated testing of gmail 
itself, there is not much point to doing things that way.
 Google has API's defined in multiple languages (see 
https://code.google.com/p/google-api-ruby-client/ for an example using 
ruby) so they make zero effort to have the UI be 'friendly' to anyone doing 
automation, and in fact at times I think it's intentionally hostile. 
If your test code needs to access the email (to see if an email was sent, 
etc) I'd either use the google API's, or an IMAP or POP3 library to access 
the mail.  The latter would likely be superior as they are more 'standard' 
interfaces and less likely to change, and also would work with services 
other than gmail if that becomes necessary.
 

>
>
> On Mon, Aug 5, 2013 at 10:42 AM, Nikhil Nerkar 
> 
> > wrote:
>
>> I want to login to gmail using userid & password from the excel stored on 
>> my machine.
>> I am getting the error :
>>
>> C:/Documents and 
>> Settings//Desktop/Watir/Project/TestProject/S10.rb:5:in `': 
>> private method `open' called for Roo::Excelx:Class (NoMethodError)
>>
>> *Please advice*
>>
>>
>> require 'watir'
>> require 'rubygems'
>> require 'roo'
>>
>> xl = Roo::Excelx.open("C:\Documents and 
>> Settings\\Desktop\Watir\Project\TestProject\TestExcel.xlsx")
>> xl.default_sheet = xl.sheets[0]
>> c1=x1.cell(1,2)
>> c2=x1.cell(2,2)
>>
>> B=Watir::Browser.new
>> url="http://www.gmail.com";
>> B.goto(url)
>>
>> B.text_field(:id,'Email').set c1
>> B.text_field(:id,'Passwd').set 'abc'
>> B.button(:value,'Sign in').click
>>
>>  -- 
>> -- 
>> Before posting, please read http://watir.com/support. In short: search 
>> before you ask, be nice.
>>  
>> watir-...@googlegroups.com 
>> http://groups.google.com/group/watir-general
>> watir-genera...@googlegroups.com 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Watir General" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to watir-genera...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: require Watir Vs Include Watir

2013-08-05 Thread Chuck van der Linden
On Monday, August 5, 2013 3:08:11 AM UTC-7, Nikhil Nerkar wrote:

> Thanks. Another similar question I have... What is the difference between 
> require *watir *& require *water-classic *?


Watir is a wrapper around watir-classic (the original IE only version) and 
watir-webdriver (the new version that supports any browser that webdriver 
supports)  

if you require watir, what version you get depends on what browser you 
start up when you create a new browser object.   If you require 
watir-classic you have the older version that will only work with IE, but 
is sometimes able to drive IE better than webdriver can (which is why it is 
still around)  

>
> On Friday, August 2, 2013 6:52:15 PM UTC+5:30, Nikhil Nerkar wrote:
>>
>> Hia silly question :)
>> What is the difference between require "watir" & include "watir" ?
>> Are they same ?
>>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [wtr-general] Unable to access the elements in a page.

2013-08-05 Thread Chuck van der Linden
On Monday, July 22, 2013 2:22:07 AM UTC-7, Željko Filipin wrote:

> On Mon, Jul 22, 2013 at 10:24 AM, Sachin Uplaonkar 
> 
> > wrote:
>
>> "irb(main):008:0> b.text.include? "suplaonk"
>> Selenium::WebDriver::Error::
>> **NoSuchElementError: Unable to find element with tag
>> name == body"
>>
>> "irb(main):036:0> b.text.include? "suplaonk"
>> Errno::ECONNREFUSED: No connection could be made because the target 
>> machine acti
>> vely refused it. - connect(2)"
>>
>
> Can you provide more relevant code? Is the site you are testing public? 
> (Please provide it's URL in that case.) If it is not public, can you 
> reproduce the error with a public site?
>
> Željko
> --
> https://leanpub.com/watirbook
>

Is the login page opening a new window?  or changing security context?  the 
behavior you are seeing is a bit like the browser object is no longer 
pointing to an instance of a web browser. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: [watir-webdriver] enablePersistentHover capability access

2013-08-05 Thread Chuck van der Linden
On Monday, July 22, 2013 8:31:42 AM UTC-7, Alex Shtayer wrote:

> Hi folks
>
> Does somebody know how to access capabilities from 
> https://code.google.com/p/selenium/wiki/DesiredCapabilities page?
>
> I am able to access capabilities only from first three tables:
> require 'watir-webdriver'
> caps = Selenium::WebDriver::Remote::Capabilities.ie
> => # @capabilities={:browser
> _name=>"internet explorer", :version=>"", :platform=>:windows, 
> :javascript_enabl
> ed=>false, :css_selectors_enabled=>true, :takes_screenshot=>true, 
> :native_events
> =>false, :rotatable=>false, :firefox_profile=>nil, :proxy=>nil}>
>
> But what about any other (for example specific for IE)?
>
> I have tried different version of selenium-webdriver gem (and of course 
> newer than 2.26) without any luck
>
> Thanks,
> Alex
>

Since you are calling to webdriver directly, that's really a webdriver 
question, I'd ask in their group. 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: Any fast ways to parse a table

2013-08-02 Thread Chuck van der Linden
I doubt it would beat the speed of nokogiri, but I have to wonder, if you 
were to assemble the row contents as a string or regex, lets call it 
'expected', and then simply look for the row via .row(:text => expected). 
 how fast would that be?


On Monday, July 15, 2013 8:51:09 AM UTC-7, Super Kevy wrote:
>
> Awesome just the advise I'm looking for, thanks for contributing.   
>
> On Friday, July 12, 2013 9:31:20 PM UTC-5, Justin Ko wrote:
>>
>> The "CheckTableUsingRowArray" approach does not seem faster to me. The 
>> location of the timer excludes the Watir portion of the code, which is 
>> costly. In particular, the following line adds about 28 seconds for me:
>>
>> myTableArray = obj.to_a  #Array the table
>>
>> An alternative approach is to use the Nokogiri gem to parse the table. 
>> Zeljko had a good post on the topic - 
>> http://zeljkofilipin.com/watir-nokogiri/ . 
>>
>> Try the following, which takes about 0.1 seconds:
>>
>> #myHash is the same ordered hash used in the other approaches:
>> myHash = { 'col1' => 'Row30 Content1', 'col2' => 'Row30 Content2', 'col3' 
>> => 'Row30 Content3', 'col4' => 'Row30 Content4', 'col5' => 'Row30 
>> Content5', 'col6' => 'Row30 Content6', 'col7' => 'Row30 Content7', 'col8' 
>> => 'Row30 Content8' }
>> myArray = myHash.values
>>   
>> start = Time.now 
>> obj = ie.table(:id,'table1')
>> nokogiri = Nokogiri::HTML.parse(obj.html)
>> nokogiri.css('tr').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
>>
>>
>>
>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: watir-classic 3.2.0 - issue with file_field in IE9

2013-08-02 Thread Chuck van der Linden
On Tuesday, July 30, 2013 5:09:49 AM UTC-7, tkp wrote:

> Currently, I am facing this issue too. But I have been running the same 
> version of Watir (3.0.0) since the past 1 year but never encountered this. 
> But now I can see this on all the installations of IE-9. Is there any 
> workaround for the same?
>

Did IE recently update, perhaps a security update or something?

Since compatibility mode makes a difference I'd almost start to suspect 
some kind of client side javascript.  Have you looked to see if that field 
has any events like onchange that are defined for the field itself or that 
CSS class?  Maybe after setting the value you have to do something like 
fire an onchange, or mouseout or some other command to trigger some client 
side code? 



> On Wednesday, 24 October 2012 20:08:16 UTC+5:30, Kevin Scott wrote:
>>
>> Wish I better news but this issue is also being tracked via 
>> http://stackoverflow.com/questions/12933283/watir-file-field-clears-in-ie9-after-setting-the-filepath
>>  
>>
>> On Monday, October 15, 2012 12:22:49 PM UTC-4, Kevin Scott wrote:
>>>
>>> When using the below code in an IE8 environment with Ruby 1.8.6 & Watir 
>>> 1.6.5 installed - everything works as designed.
>>>
>>> b.file_field(:id, 
>>> 'fileName').set('C:\projects\testcases\booksmart\watir\test_data\2010-01-30-XML3.zip')
>>>  
>>> b.button(:name, 'upload').click()
>>>
>>> When using the same code in an IE9 environment with compatibility mode 
>>> OFF with Ruby 1.9.3 & Watir 3x (I have tried 3.0.0/3.01/3.0.2), there is an 
>>> issue. Basically, here is what I am seeing:
>>>
>>> Upon execution of *b.file_field(:id, 
>>> 'fileName').set('C:\projects\testcases\booksmart\watir\test_data\2010-01-30-XML3.zip')
>>>  
>>> *line of code, the file_field is populated correctly. On click of the 
>>> button -* b.button(:name, 'upload').click()* - the value of file path 
>>> is no longer visible in the file_field. The file is not uploaded.
>>>
>>> The above code is fine when compatibility mode is ON. 
>>>
>>>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Anyone else having trouble with latest chromedriver for mac?

2013-08-02 Thread Chuck van der Linden
Is anyone else that tends to work with a mac and Chrome having problems 
with the latest chromedriver?  after installing it all my scripts started 
failing.  Rolling back to the older version got things working again.

Details:

I have a script that is working pretty well and is generally very reliable. 
I do most of my script development on a mac with OSX 10.8.4 using chrome, 
cucumber, watir-webdriver, and the test-factory gem for page and data 
objects.   All has been well so far.

  I recently upgraded chrome on my system and figured it would be a good 
idea to update chromedriver also since it was now like about 6 months old. 
 After doing so every script started failing. Always with the same error.  

 unexpected response, code=404, content-type=""
  unknown command: 
session/ccc759fed3a262faf632dd11ca4067b2/element/name 
(Selenium::WebDriver::Error::WebDriverError)
  ./lib/data_objects/agent.rb:29:in `block in signed_in?'
  ./lib/data_objects/agent.rb:28:in `signed_in?'
  ./features/step_definitions/signin_and_signup.rb:60:in `/^I am signed 
in as a TCC Employee$/'
  features/no_js_errors.feature:113:in `Given I am signed in as a TCC 
Employee'

Due to the nature of my scripts it was all at the same spot, which is part 
of my login step which checks to see if the right user is logged in, if not 
calls logout and logs in the needed user. That's line 29 in the error 
above, which is the central line in this method

 def signed_in?
on CommonHeader do |page|
  return page.session_links.exists? ? page.current_user == 
"#{@firstname} #{@lastname}" : false
end
  end

 page.session_links.exists? amounts to  "b.ul(:id => 
"session-links").exists?" 

which is checking to see of the UI element that holds the current user's 
name is present on the page.  A pretty simple call, and I expect it to fail 
at this point as nobody is logged in when the script starts.  Not rocket 
science, a simple 'exists' call.   Which btw works perfectly well if I 
invoke IRB, but fails universally when stuff is run via cucumber.

Replacing the shiny new chromedriver with the deprecated version from 6 
months old makes everything go back to functioning as expected.  

As far as I can tell the rest of my stuff is up to date
  Cucumber 1.3.3
  Selenium-webdriver 2.33.0
  Watir-webdriver 0.6.4
  Test-factory 0.2.9

Anyone else seen this or seen anyone having a similar issue? 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: Testing Methodology with Watir

2013-08-02 Thread Chuck van der Linden
On Monday, July 22, 2013 11:05:38 PM UTC-7, Jorge Gastaldi wrote:

>
>
> This is something that must be somewhere on the net, but I couldn't 
> find. 
>
> I have used Watir for some scripts, small things. But I think that 
> could be very nice to use it at work as an integral part of the development 
> and testing cycle. So I want to know about the best practices and usual 
> methodology for Watir for development and/or testing teams. One of my main 
> concerns is: if the testing team builds the Watir tests, they have to know 
> deep details of the web page implementation? That's something I would like 
> to avoid.
>
>
> As couldn't find information about it, I've thinking and came up with 
> a little plan. I would be very grateful about any feedback about it.
>
> We work mostly with CRUDs or CRUD-like web pages, so this could be a 
> generic work flow:
>   
>   * The developer finish a web page.
>   * He builds a set of Watir functions that only covers the Create, 
> Restore, Update, Delete functionality (if applies) and little more. For 
> example, "addPerson(personId, organisationId)".
>   * Then the testing team build the integration tests using this "high 
> level" functions.  Something like:
>
>organisationId  = createOrganisation(...)
>personId = createPerson(...)
>addPerson(organisationId, personId)
>
> 
>
>  I see several advantages with this approach (that maybe is what 
> everybody is doing):
>
> * The developers and testers get some useful functions to work 
> with. Very practical to setup some testing data for unit or other tests.
> * If you have the functions, there was _at least_ a basic unit 
> testing. This shouldn't be a big advantage... but at some teams it is
> * The testers don't have to know how the web page was implemented.
> * The maintenance of the test cases should be pretty straight 
> forward: every time you change a web page, you now quite easily which 
> functions you should update. The integration tests will be also pretty easy 
> to find and even easier to fix.
>
>Again, any feedback or advice is more than welcome.
>
>
>   Thanks in advance,
>   Jorge
>
>
>   (sorry about my English)
>
>
So my take on this is a little different.  I'm a big fan of 'test first', 
at the code level this tends to mean unit tests.  At the feature level a 
good approach is to use an "Executable Specification", and a good way to do 
that is "Specification by Example" (see http://www.manning.com/adzic/ )

What tool you use for that depends on what languages you and your 
developers are comfortable with.  If they are happy with Ruby, then using 
Cucumber along with Watir for those tests that are UI facing is a great 
choice.  and in that case I strongly recommend reading 'the cucumber book' 
to get started in the right direction.

Cucumber gives you one aspect of re-usable and maintainable code which is 
the idea of common steps that can be re-used.

The other good practice is the Page Object and Data Object patterns.  

Page objects model the application's web pages and consist of logical names 
for page elements along with how those elements are identified.  That gives 
you a way to address page elements by name in your scripts so that if the 
site changes, you have one place to change in order to update your scripts.

  Data objects do a similar thing for having a logical way to persist a 
'test side copy' of data objects (such as users, items for sale in a store, 
a shopping cart)  and also provide a way to pass that test data from one 
step to another in your code.  Similar to page objects this also gives you 
one place to have methods for things like say updating a user profile, 
logging in, etc.  Data objects typically have a set of default values for 
an object of that type, and you can create them using entirely the 
defaults, or overide any or all parameters as needed.  A similar approach 
is used for methods that do things for filling out a form.

Both of those are what are referred to as 'abstraction layers' 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: Adobe Air and watir web driver

2013-08-02 Thread Chuck van der Linden
That would do it

On Tuesday, July 23, 2013 8:15:07 AM UTC-7, fabian@gmail.com wrote:
>
> It's not because of Adobe Air. It's because the form is within an iframe...
>
> fabian
>
> El martes, 23 de julio de 2013 10:57:01 UTC-3, fabian@gmail.comescribió:
>>
>> Hi Guys,
>>
>> Anyone had problems with Adobe Air webpages? I'm having trouble locating 
>> a simple text input field and I noticed the form is an adobe air form. My 
>> code:
>>
>> browser.goto '
>> http://localhost:8080/MasterAIRForms.asp?AIR=MasterFileServer&ReqID=874884
>> '
>>
>> browser.text_field(:name => 
>> 'ctl00$ContentPlaceHolderCode$txtServerName').when_present.set 'myServer'
>>
>> It times out after 30 seconds although the form is loaded perfectly.
>>
>> Thanks,
>> Fabian
>>
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: require Watir Vs Include Watir

2013-08-02 Thread Chuck van der Linden
google 'ruby require vs include'

they are very different, and for most users, unless you are doing something 
very specific, you want to use require. 

On Friday, August 2, 2013 6:22:15 AM UTC-7, Nikhil Nerkar wrote:
>
> Hia silly question :)
> What is the difference between require "watir" & include "watir" ?
> Are they same ?
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[wtr-general] Re: Introducing Watirsome

2013-05-17 Thread Chuck van der Linden
On Monday, May 13, 2013 11:36:12 PM UTC-7, Alex Rodionov wrote:

> Hey guys!
>
> I've recently released Watirsome, which is a gem I've been using at work 
> for a long time as an alternative to well known page-object. 
>
> It's a lot similar to it, but more dynamic and based on watir-webdriver. 
> Thus (at least for now), it works only with it.
>
> Anyways, you can take a look at https://github.com/p0deje/watirsome and 
> probably give it a shot!
>

How is it different from, or would you contrast it with the "test-factory" 
page objects gem?  http://rubygems.org/gems/test-factory

just wondering as that is a lightweight, designed for Watir page objects 
gem that I'm using (and so far like very much) 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




  1   2   3   4   5   6   7   8   9   10   >