there is a trick you can use when using stylesheets and id tags ( i forget 
exactly what/why) , but there are definitely other ways and probably better 
ways to do it.
How much time will it take for him to change the divs to use 
class='some_css_clss' and ad ids, compared to you finding a way round this? My 
guess is its going to be better for everyone if he does it correctly.
Can he put names on instead?
How about a custom attribute ( <div id=css_hack tester_thing=id1> ) and then 
you do a quick hack in wastir to use testter_thing as an attribute ( thats 
actually pretty easy I think )

Some on the thread mentioned multi-lingual problems so they couldnt use :text - 
heres how I fixed that.  I already had hundreds of elements coded, so couldnt 
afford the time to go back and change them all 

$lang = :french
ie.div(:text , 'Click Me') .click

We overrode the various watir methods- to check the $lang if its not set it 
uses english, otherwise it uses the specified language. Then looks up in an 
array ( or xml, or yaml, or whatever) and finds the english ( in this case 
CLick Me )
It then looks for the equivalent in the supplied language.. 
This way your script is still readable in English.
Im sure its not the best way, but as we had lots of code already it seemed like 
the best way


  ----- Original Message ----- 
  From: Adam Reed 
  To: wtr-general@rubyforge.org 
  Sent: Friday, March 16, 2007 8:32 AM
  Subject: Re: [Wtr-general] Click on button which isn't a button


  This brings up an interesting issue that came up yesterday.  We have a new 
front-end designer on staff who was creating some mockups for a new project.  I 
was getting familiar with his code and using watir to navigate around, and 
noticed that of the ~90 divs on the page, only 5-6 have unique (or any) id 
tags.  These unnamed divs make up the primary navigation system for the site.  
There are no images, buttons or tables on the page.

  So of course, not thinking much into it - I ask if it would be possible for 
him add unique id tags to the major navigational elements (50% of the divs are 
not important to anything other than design).  He replied, saying that adding 
unique ids to all elements would wreak havoc with style sheets, since all of 
these unnamed divs share the same style information.  Also, for Search Engine 
Optimization (SEO), he needs to keep as much unnecessary text off the page as 
possible (although this point is debatable).

  In this case, where do we go from here?  I completely understand his point, 
but at the same time I would be prevented from automating the majority of the 
tests on the new site.  Of course we don't rely 100% on automation (probably 
less than 50%), but 100% manual testing requires quite more time, and produces 
many fewer test results.

  I'd be interested to hear solutions, or just comments on the issue - I know 
it has to be fairly common.

  -- Adam



------------------------------------------------------------------------------
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Željko Filipin
  Sent: Friday, March 16, 2007 8:38 AM
  To: wtr-general@rubyforge.org
  Subject: Re: [Wtr-general] Click on button which isn't a button


  If language changes I would recommend that you ask your developer to add an 
id attribute to div tag. Then you would not have to rely on text. If that is 
not the option, you can try this.

  ie.cell(:html, /registration/).click 

  or

  ie.cell(:html, /registration/).div(:text, //).click
  -- 
  ZeljkoFilipin.com 


------------------------------------------------------------------------------


  _______________________________________________
  Wtr-general mailing list
  Wtr-general@rubyforge.org
  http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to