[Wtr-general] Unknown Method error in Watir 1.4

2005-08-23 Thread Angrez Singh

 
Hi,

I have downloaded Watir 1.4 and got the following error while trying to access 'to_s' method of 'P' element.

My script accesses the 'P' element using the 'id' attribute. The code looks like this:
  
  1. element = $ie.p(:id,pElement)
  2. puts element.type
  3. puts element.to_s

The exact error is:
P
d:/installations/ruby/lib/ruby/site_ruby/1.8/watir.rb:2211:in `span_div_string_creator': undefined method `style' for #Watir::P:0x2ac7f38 (NoMethodError)
from d:/installations/ruby/lib/ruby/site_ruby/1.8/watir.rb::in `to_s'
from testXpath.rb:10

The 'P' on first line is shown due to line no.2 of the code shown above but when I try to access 'to_s' method it gives an error.

I think there is a bug in the 'span_div_string_creator' method of 'class SpanDivCommon'

The code of this function looks like this in version 1.4:
  # this method is used to populate the properties in the to_s method
def span_div_string_creator
  n = []
  n   style:.ljust(TO_S_SIZE) + self.style
  n   text:.ljust(TO_S_SIZE) + self.text
  return n
 end
 private :span_div_string_creator

Now when we try to do 'self.style' an error is thrown because there is no property or method called 'style' for 'IHTMLParaElement' whose object we access in watir.

For more information:
http://msdn.microsoft.com/library/default.asp?url="">

This link from MSDN shows that 'IHTMLParaElement' has only one property called 'align'

Similarly while accessing 'SPAN' element I got the same error because 'IHTMLSpanFlow' element also contains only 'align' property.

For more information:
http://msdn.microsoft.com/library/default.asp?url="">

This holds true from 'DIV' element also because 'IHTMLDivElement' contains properties 'noWrap' and 'align'
For more information:
http://msdn.microsoft.com/library/default.asp?url="">

Or am I missing something completely here?

Regards,
Angrez



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


Re: [Wtr-general] Unknown Method error in Watir 1.4

2005-08-23 Thread Bret Pettichord

This is fixed in 1.4.1

At 07:57 AM 8/23/2005, Angrez Singh wrote:



Hi,

I have downloaded Watir 1.4 and got the following error while trying to 
access 'to_s' method of 'P' element.


My script accesses the 'P' element using the 'id' attribute. The code 
looks like this:


  1. element = $ie.p(:id,pElement)
  2. puts element.type
  3. puts element.to_s

The exact error is:
P
d:/installations/ruby/lib/ruby/site_ruby/1.8/watir.rb:2211:in 
`span_div_string_creator': undefined method `style' for 
#Watir::P:0x2ac7f38 (NoMethodError)
from 
d:/installations/ruby/lib/ruby/site_ruby/1.8/watir.rb::in `to_s'

from testXpath.rb:10

The 'P' on first line is shown due to line no.2 of the code shown above 
but when I try to access 'to_s' method it gives an error.


I think there is a bug in the 'span_div_string_creator' method of 'class 
SpanDivCommon'


The code of this function looks like this in version 1.4:
  # this method is used to populate the properties in the to_s method
def span_div_string_creator
n = []
n   style:.ljust(TO_S_SIZE) + self.style
n   text:.ljust(TO_S_SIZE) + self.text
return n
end
private :span_div_string_creator

Now when we try to do 'self.style' an error is thrown because there is no 
property or method called 'style' for 'IHTMLParaElement' whose object we 
access in watir.


For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/paraelement/paraelement.asp

This link from MSDN shows that 'IHTMLParaElement' has only one property 
called 'align'


Similarly while accessing 'SPAN' element I got the same error because 
'IHTMLSpanFlow' element also contains only 'align' property.


For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/spanflow/spanflow.asp

This holds true from 'DIV' element also because 'IHTMLDivElement' contains 
properties 'noWrap' and 'align'

For more information:
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/divelement/divelement.asp

Or am I missing something completely here?

Regards,
Angrez


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


_
 Bret Pettichord
 www.pettichord.com

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