[wtr-general] Re: Problems using visible

2008-10-30 Thread Paul Rogers

the html in the app is way to scary to simplify and post ( goto
www.tynt.com and use the try it functionality if youd like to see )

I'll try and post a sample of this though

Paul

On Thu, Oct 30, 2008 at 1:52 AM, Tony [EMAIL PROTECTED] wrote:

 Hi Bret,

 Added the updated code to the ticket. (http://jira.openqa.org/browse/
 WTR-262)
 Have added a testhtml file to test the visibility feature.
 Have added a ruby test file to test using the html file. (this is
 currently using the same structure as watir 1.5.6 unit tests)
 The same code can be run against firefox .. (require and includes need
 to be changed)

 Hi Paul,
 Didn't know about this technique (moving an element by changing it
 coordinates) to hide something.
 Using visibility and display as none and hidden , the elements still
 remain in DOM.
 Don't know how moving the coordinates makes it faster to make it
 appear quicker.

 Could you share your html and your modified visible method? Would be
 great to understand how this is done.

 Thanks,
 Tony
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Tony

ahh ... forgot about the visibility attribute. :)
The below is the updated code

def visible?
 jssh_command = var val = 'true'; var str = ''; var obj =
#{element_object}; while (obj != null) { try { str =
document.defaultView.getComputedStyle(obj,null).visibility; if
(str=='hidden') { val = 'false'; break; } str =
#{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
(str=='none') { val = 'false'; break; }  } catch(err) {} obj =
obj.parentNode; } val;

 jssh_socket.send(#{jssh_command}\n, 0)
 vals = read_socket()
 return (vals == 'false')? false: true
end
public:visible?

-Tony
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Tony

Was running the tests for some time .. and suddenly i started getting
wrong results for visible.
Look like the #{element_object} was returning null sometimes. Dont
know why
Started working after adding assert_exists
Heres the updated code -

class Element
def visible?
 assert_exists
 jssh_command = var val = 'true'; var str = ''; var obj =
#{element_object}; while (obj != null) { try { str =
document.defaultView.getComputedStyle(obj,null).visibility; if
(str=='hidden') { val = 'false'; break; } str =
#{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
(str=='none') { val = 'false'; break; }  } catch(err) {} obj =
obj.parentNode; } val;
 jssh_socket.send(#{jssh_command}\n, 0)
 vals = read_socket()
 return (vals == 'false')? false: true
end
public:visible?
end


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Bret Pettichord

I opened up a ticket with your suggestion. Would you mind updating it 
with your latest code?
http://jira.openqa.org/browse/WTR-262


Tony wrote:
 Was running the tests for some time .. and suddenly i started getting
 wrong results for visible.
 Look like the #{element_object} was returning null sometimes. Dont
 know why
 Started working after adding assert_exists
 Heres the updated code -

 class Element
 def visible?
  assert_exists
  jssh_command = var val = 'true'; var str = ''; var obj =
 #{element_object}; while (obj != null) { try { str =
 document.defaultView.getComputedStyle(obj,null).visibility; if
 (str=='hidden') { val = 'false'; break; } str =
 #{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
 (str=='none') { val = 'false'; break; }  } catch(err) {} obj =
 obj.parentNode; } val;
  jssh_socket.send(#{jssh_command}\n, 0)
  vals = read_socket()
  return (vals == 'false')? false: true
 end
 public:visible?
 end


 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-29 Thread Paul Rogers

for people in the future searching the archives, its also worth noting
that visible? has some other problems. The app i work on 'hides' stuff
from the user by moving it to coordinates -1000, -1000. THis way the
thing is still in the dom, and can be made to appear quicker by
changing its coordinates.

So ive modified my visible? methods accordingly

Paul

On Wed, Oct 29, 2008 at 8:35 AM, Bret Pettichord [EMAIL PROTECTED] wrote:

 I opened up a ticket with your suggestion. Would you mind updating it
 with your latest code?
 http://jira.openqa.org/browse/WTR-262


 Tony wrote:
 Was running the tests for some time .. and suddenly i started getting
 wrong results for visible.
 Look like the #{element_object} was returning null sometimes. Dont
 know why
 Started working after adding assert_exists
 Heres the updated code -

 class Element
 def visible?
  assert_exists
  jssh_command = var val = 'true'; var str = ''; var obj =
 #{element_object}; while (obj != null) { try { str =
 document.defaultView.getComputedStyle(obj,null).visibility; if
 (str=='hidden') { val = 'false'; break; } str =
 #{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
 (str=='none') { val = 'false'; break; }  } catch(err) {} obj =
 obj.parentNode; } val;
  jssh_socket.send(#{jssh_command}\n, 0)
  vals = read_socket()
  return (vals == 'false')? false: true
 end
 public:visible?
 end


 



 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-28 Thread Tony

Hi All,

Here's a solution to find the visible elements in Firefox.
Override the Elements class in MozillaBaseElement.rb file to include
the below code -

require 'firewatir'
class Element

def visible?
 jssh_command = var val = 'true'; var str = ''; var obj =
#{element_object}; while (obj != null) { try { str =
#{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
(str=='none') { val = 'false'; break; }  } catch(err) {} obj =
obj.parentNode; } val;

 jssh_socket.send(#{jssh_command}\n, 0)
 vals = read_socket()
 vals
end
public:visible?

end

The above uses the same logic as the wiki page that Željko had
mentioned for overriding watir's visible method.
Hence the visible method should work the same way in both ie and
firefox.
Hope this is helpful 

-Tony
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-28 Thread Paul Rogers

in my implementation I seem to also be checking the value of the
visibility css attribute.

Paul

On Tue, Oct 28, 2008 at 8:04 AM, Tony [EMAIL PROTECTED] wrote:

 Hi All,

 Here's a solution to find the visible elements in Firefox.
 Override the Elements class in MozillaBaseElement.rb file to include
 the below code -

 require 'firewatir'
 class Element

 def visible?
  jssh_command = var val = 'true'; var str = ''; var obj =
 #{element_object}; while (obj != null) { try { str =
 #{DOCUMENT_VAR}.defaultView.getComputedStyle(obj,null).display; if
 (str=='none') { val = 'false'; break; }  } catch(err) {} obj =
 obj.parentNode; } val;

  jssh_socket.send(#{jssh_command}\n, 0)
  vals = read_socket()
  vals
 end
 public:visible?

 end

 The above uses the same logic as the wiki page that Željko had
 mentioned for overriding watir's visible method.
 Hence the visible method should work the same way in both ie and
 firefox.
 Hope this is helpful 

 -Tony
 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-23 Thread al3kc

Should this work for FireWatir? I tried to change it for
FireWatir::Element but it doesn't work.

Željko Filipin [EMAIL PROTECTED] wrote:
 On Mon, Sep 8, 2008 at 5:48 PM, Bret Pettichord [EMAIL PROTECTED] wrote:
  I think you need to require something before using this method. Any one?

 http://wiki.openqa.org/pages/viewpage.action?pageId=1119

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---



[wtr-general] Re: Problems using visible

2008-10-23 Thread Bret Pettichord

This code is IE specific.

al3kc wrote:
 Should this work for FireWatir? I tried to change it for
 FireWatir::Element but it doesn't work.

 Željko Filipin [EMAIL PROTECTED] wrote:
   
 On Mon, Sep 8, 2008 at 5:48 PM, Bret Pettichord [EMAIL PROTECTED] wrote:
 
 I think you need to require something before using this method. Any one?
   
 http://wiki.openqa.org/pages/viewpage.action?pageId=1119
 

 
   


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~--~~~~--~~--~--~---