I'm dropping this little chunk of code in there that tries to pull
style attributes from fields.  What I'm attaching you can copy right
into an .rb file and run.  You can also toggle from IE to Firefox.
I'm not sure if this was the best page to test against but since I'm
asking for lots of help here I figured I would make it as easy as
possible for someone to see and try what I am up against.  So if
anyone has a few minutes to give it a shot that would be much
appreciated. thanks every one for the help.

require 'watir'

@Browser = "IE"
#...@browser = "FireFox"
@Test_site = "http://www.google.com/advanced_search?hl=en";

Watir::Browser.default = @Browser.downcase
Watir.options[:browser]= @Browser.downcase
$Browser = Watir::Browser.new #try to launch the browser
$Browser.goto @Test_site #Navigate to page
$Browser.wait;

#works in IE
puts $Browser.text_field
(:name,'as_q').document.currentstyle.fontFamily

On Jun 9, 11:40 am, Chuck van der Linden <sqa...@gmail.com> wrote:
> what I've noticed re .style is that for some things that are standard
> (visibility for example) I can just do
>
>   browser.element(how,what).style.visibility
>
> For some other things we've defined outselves  (for example we use 'z-
> index')  we had to remove special characters (the dash) and do it in
> all caps as if it were a constant
>
>   browser.element(how,what).style.ZINDEX
>
> but then our primary supported browser is IE (kinda comes with it
> having largest share (for a little while longer anyway) and company
> being a MS gold level partern) and firefox is secondary.   So I don't
> do a lot of this sort of thing with FF..
>
> On Jun 9, 8:32 am, Loft_Tester <aaronr...@gmail.com> wrote:
>
>
>
> > Is there a differant method other than invoke for style that works?
>
> > On Jun 9, 11:25 am, Loft_Tester <aaronr...@gmail.com> wrote:
>
> > > Ok, I tried to use style.
> > > For IE this works.
> > > puts $Browser.text_field(:id,/PART/).style.invoke('left')
>
> > > when I try it in firefox I get   Exception: "undefined method `invoke'
> > > for "[object CSSStyleDeclaration]":String" has Occurred
>
> > > I feel as though I'm close I'm just missing something simple.  Am I
> > > using style correctly for firefox
>
> > > On Jun 8, 5:02 pm, Chuck van der Linden <sqa...@gmail.com> wrote:
>
> > > > have you tried just using the .style method on the specific object?
>
> > > > On Jun 8, 11:00 am, Loft_Tester <aaronr...@gmail.com> wrote:
>
> > > > > Is there another workaround for this? Thanks
>
> > > > > On Jun 8, 10:38 am, Loft_Tester <aaronr...@gmail.com> wrote:
>
> > > > > > OK, I tried working on this for sometime but I haven't come up with
> > > > > > anything that works.  I think my problem is that I am not familiar
> > > > > > with jssh command language and how it works.  maybe if I get some 
> > > > > > help
> > > > > > with one conversion I'll be able to do the rest on my own.
>
> > > > > > I have this field $Browser.text_field(:id,"part")
>
> > > > > > In the method I created it pretty much looks like this
>
> > > > > > fieldID = 'part'
> > > > > > styleID = 'left'
> > > > > > attribute  = $Browser.text_field
> > > > > > (:id,fieldID).document.currentstyle.send(styleID ) #(ruby's send 
> > > > > > works
> > > > > > awsome for thie)
>
> > > > > > "attibute" is equal to lefts value
>
> > > > > > So what I need to to figure out how to input the field ID and 
> > > > > > property
> > > > > > I'm looking for and have it return the correct value.  Thanks again
> > > > > > for all the help- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to