[wtr-general] Re: Inconsistent Frame behavior

2011-08-08 Thread Stephen Lee
Problem I'm Trying To Solve
On a non-secure (http) page, when you click a Log in link we load a
secure login form inside an iframe. I'm trying to wait for it to load
before filling it out and submitting. Simple enough, right?

Approach
1. Wait for the iframe to exist
2. Wait for the password field to exist
3. Wait for the password field to become visible
4+ Fill out the form and submit

Code I Want To Use (Works some of the time, randomly)
…
33  Wait.until { @browser.frame(:index, 1).exists? } #Always works
34  Wait.until { @browser.frame(:index, 1).text_field(:id,
password).exists? } #Always works
35  Wait.until { @browser.frame(:index, 1).text_field(:id,
password).visible? } #Failure line, when it fails
… # Then fill it out etc, which is working fine

Unhelpful Error I Get When It Fails
wrong number of arguments (2 for 1) (ArgumentError)
./features/step_definitions/secure_login_steps.rb:35
./features/step_definitions/secure_login_steps.rb:35:in `/^I log in
using the overlay$/'
features/secure_login.feature:9:in `When I log in using the overlay'

What I Think Is Happening
It seems like @browser.frame(:index, 1) and @browser.frame(:index,
1).locate aren't always returning the frame, but are rather sometimes
returning the parent document.

If this is the case, it's possible that in line (34) above, the
@browser.frame(:index, 1) is returning the parent document, and it's
thus checking that the wrong password text exists (which is already
on the parent document, so it returns true immediately), and then in
line (35) @browser.frame(:index, 1) returns the iframe, which hasn't
fully loaded yet, so it's trying to check .visible? on a nonexistent
object, and bombing out.

My two questions are:
1. Is .frame() known to be inconsistent like this? Am I doing it
wrong?
2. Is there a better, simpler way to achieve my overall goal than what
I'm doing?

Thanks,
Steve

Env:
Cuke 1.0.0
Firewatir 1.8.0
watir-webdriver 0.2.0
Ruby 1.8.7
Firefox 3.6.19
JSSh 0.9

On Aug 5, 2:33 pm, Stephen Lee stephen.ryan@gmail.com wrote:
 heh, sorry - hit tab instead of caps lock on accident, then enter,
 and prematurely submitted this. More to come in a sec...

 On Aug 5, 2:22 pm, Stephen Lee stephen.ryan@gmail.com wrote:







  I'm getting inconsistent behavior when trying to work with a frame
  using firewatir

  PROBLEM I'M TRYING TO SOLVE

  Env:
  Cuke 1.0.0
  Firewatir 1.8.0
  watir-webdriver 0.2.0
  Ruby 1.8.7
  Firefox 3.6.19
  JSSh 0.9

-- 
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


[wtr-general] Re: unknown property or method 'document' when navigating to short URLs

2011-08-08 Thread Brian Lauber
Yes, when you navigate to the URL's manually, they both take you to
the same HTML page.  They both take you to the same page in Watir as
well.  It's just that after Watir navigates to the short URL, it seems
to lose its connection with the browser.

On Jul 29, 3:06 am, Dave McNulla mcnu...@gmail.com wrote:
 When you navigate to those two url's manually through the same browser on
 the same system, do you get the same html page? I've seen problems caused by
 missing qualified domain name in the DNS suffix list.

 Dave

-- 
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


[wtr-general] problem with Watir gem 1.9.2

2011-08-08 Thread Jeff Canna

Hello,

I've just installed the ruby watir gem 1.9.2 running with Ruby version
1.8.7 patch level 334.

The watir script that had been working prior to upgrading to 1.9.2 is
calling into the IE browser with
default browser.radio(:id,'radio id string')

the error I am getting is below:
NameError: uninitialized constant Watir::Container::Radio
c:/ruby187/lib/ruby/gems/1.8/gems/watir-1.9.2/lib/watir/
container.rb:452:in `radio'

Could someone point me in a direction to help me figure out what is
wrong

-- 
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


[wtr-general] Iterate over direct successor divs which are not unique identifiable

2011-08-08 Thread Benjamin Heilbrunn
Hello,

i have the following situation:

div class=myclass
   div
  div/div
   /div
   div
  div/div
  div/div
   /div
/div

I want to iterate over all direct successor divs of the myclass-div.
How can I do that?

If I use browser.div(:class, myclass).divs i also get the 3
transitive successors of the div, but I'm only interested in the 2
direct successors.

-- 
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


Re: [wtr-general] Iterate over direct successor divs which are not unique identifiable

2011-08-08 Thread Željko Filipin
On Mon, Aug 8, 2011 at 10:37 AM, Benjamin Heilbrunn ben...@gmail.com
wrote:
 I want to iterate over all direct successor divs of the myclass-div.

XPath?

http://wiki.openqa.org/display/WTR/XPath

Željko
--
watir.com - community manager
watir.com/book - author
watirpodcast.com - host

-- 
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


Re: [wtr-general] Iterate over direct successor divs which are not unique identifiable

2011-08-08 Thread Alister Scott
I'd do something like 

browser.div(:class, myclass).divs.collect { | div | div.div.exists? }

-- 
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


Re: [wtr-general] Iterate over direct successor divs which are not unique identifiable

2011-08-08 Thread Alister Scott
I'd do something like 

browser.div(:class, myclass).divs.select { | div | div.div.exists? }

(that should be select not collect)

-- 
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


[wtr-general] Re: Iterate over direct successor divs which are not unique identifiable

2011-08-08 Thread Michael
You should be able to do pretty much exactly that.
browser.div(:class, myclass).divs.select { | div | div.divs.length 
0 }

On Aug 8, 4:31 am, Alister Scott alister.sc...@gmail.com wrote:
 I'd do something like

 browser.div(:class, myclass).divs.select { | div | div.div.exists? }

 (that should be select not collect)

-- 
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


Re: [wtr-general] Re: Inconsistent Frame behavior

2011-08-08 Thread Jari Bakken
On Sat, Aug 6, 2011 at 12:11 AM, Stephen Lee stephen.ryan@gmail.com wrote:

 Env:
 Cuke 1.0.0
 Firewatir 1.8.0
 watir-webdriver 0.2.0
 Ruby 1.8.7
 Firefox 3.6.19
 JSSh 0.9


Are you using firewatir or watir-webdriver? If you're using
watir-webdriver, try updating to the latest version and report back
what you find.

-- 
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


[wtr-general] Re: Inconsistent Frame behavior

2011-08-08 Thread Stephen Lee
Hey, I'm actually not using watir-webdriver, sorry about that. So just
Firewatir.

On Aug 8, 8:01 am, Jari Bakken jari.bak...@gmail.com wrote:
 On Sat, Aug 6, 2011 at 12:11 AM, Stephen Lee stephen.ryan@gmail.com 
 wrote:

  Env:
  Cuke 1.0.0
  Firewatir 1.8.0
  watir-webdriver 0.2.0
  Ruby 1.8.7
  Firefox 3.6.19
  JSSh 0.9

 Are you using firewatir or watir-webdriver? If you're using
 watir-webdriver, try updating to the latest version and report back
 what you find.

-- 
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


[wtr-general] watir-webdriver: Validating the Color of an element

2011-08-08 Thread hillary
When there's an error, the application i'm testing changes the color of the 
element, a text_field, changes to red. Currently I validate that the 
text_field is red like this: 
b.text_field(:id, text_field).document.currentstyle.color.should == 
'#444' 

I also will did to validate the color of a div message that tells the user 
that changes have been saved. i use the document.currentstyle.color for this 
also. 

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


Re: [wtr-general] watir-webdriver: Validating the Color of an element

2011-08-08 Thread Jari Bakken
WebDriver doesn't give direct access

Den 8. aug. 2011 kl. 20:34 skrev hillary weimar1...@gmail.com:

When there's an error, the application i'm testing changes the color of the
element, a text_field, changes to red. Currently I validate that the
text_field is red like this:
b.text_field(:id, text_field).document.currentstyle.color.should ==
'#444'

I also will did to validate the color of a div message that tells the user
that changes have been saved. i use the document.currentstyle.color for this
also.

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

-- 
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


Re: [wtr-general] watir-webdriver: Validating the Color of an element

2011-08-08 Thread Jari Bakken
WebDriver doesn't give direct access to the underlying DOM object like other
implementations. Instead you can use b.text_field(:id,
text_field).style(color).

Den 8. aug. 2011 kl. 20:34 skrev hillary weimar1...@gmail.com:

When there's an error, the application i'm testing changes the color of the
element, a text_field, changes to red. Currently I validate that the
text_field is red like this:
b.text_field(:id, text_field).document.currentstyle.color.should ==
'#444'

I also will did to validate the color of a div message that tells the user
that changes have been saved. i use the document.currentstyle.color for this
also.

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

-- 
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


[wtr-general] Right click and element

2011-08-08 Thread Litha K
Hi all,

I am using watir-webdriver with ruby 1.9.2 on mac OSX. In one of my
test scenarios, I want to right click and element and select from the
menu.

Please could someone let me know how we do this- is there a way to
send keys like shift+F10? or may be a better solution.

Many thanks in advance.

Regards,
Kay

-- 
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


Re: [wtr-general] Right click and element

2011-08-08 Thread Jari Bakken
Right clicking isn't yet well supported (though it does work somewhat in
Chrome), but it's being worked on. I suggest you find another way of
achieving what you want for the time being.

On Mon, Aug 8, 2011 at 9:09 PM, Litha K litha...@googlemail.com wrote:

 Hi all,

 I am using watir-webdriver with ruby 1.9.2 on mac OSX. In one of my
 test scenarios, I want to right click and element and select from the
 menu.

 Please could someone let me know how we do this- is there a way to
 send keys like shift+F10? or may be a better solution.

 Many thanks in advance.

 Regards,
 Kay

 --
 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


-- 
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


[wtr-general] Re: Right click and element

2011-08-08 Thread Litha K
Thanks Jari.

Could someone suggest a work around for this please?

Regards,
Karthik

On Aug 8, 8:21 pm, Jari Bakken jari.bak...@gmail.com wrote:
 Right clicking isn't yet well supported (though it does work somewhat in
 Chrome), but it's being worked on. I suggest you find another way of
 achieving what you want for the time being.







 On Mon, Aug 8, 2011 at 9:09 PM, Litha K litha...@googlemail.com wrote:
  Hi all,

  I am using watir-webdriver with ruby 1.9.2 on mac OSX. In one of my
  test scenarios, I want to right click and element and select from the
  menu.

  Please could someone let me know how we do this- is there a way to
  send keys like shift+F10? or may be a better solution.

  Many thanks in advance.

  Regards,
  Kay

  --
  Before posting, please readhttp://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

-- 
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


Re: [wtr-general] watir-webdriver: Validating the Color of an element

2011-08-08 Thread hillary
Thanks. 

Just to confirm, the color would be it's html value (#444), so it'd be 
.style(#444)? 

-- 
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


Re: [wtr-general] watir-webdriver: Validating the Color of an element

2011-08-08 Thread Jari Bakken
No, .style returns the value of the given CSS property. So
.style(color).should == #444.

Den 8. aug. 2011 kl. 21:38 skrev hillary weimar1...@gmail.com:

Thanks.

Just to confirm, the color would be it's html value (#444), so it'd be
.style(#444)?

-- 
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

-- 
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


Re: [wtr-general] watir-webdriver: Validating the Color of an element

2011-08-08 Thread hillary
Okay. 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