Re: [wtr-general] Re: Watir Webdriver Performance Error

2011-12-08 Thread Tim Koopmans
Yeah I agree RE non-hash return objects... I'l fire up a windows VM
this weekend and see if I can pinpoint what's being returned ... stay
tuned =)


Cheers,
Tim



On Fri, Dec 9, 2011 at 10:45 AM, Jari Bakken  wrote:
> On Thu, Dec 8, 2011 at 3:36 AM, @90kts  wrote:
>>
>> Well it appears from the OP error that the return object
>> of Browser#execute_script is a WebDriver::Element.. hence my code is failing
>> as it expects a hash.
>>
>> I'm not sure why this is doing it on Win2K8 R2 with IE9, as I don't have
>> that development platform... but it was tested on Win2K3 with IE9 as Chuck
>> mentioned.
>>
>> I could just raise an error like Jari suggested, but that won't help the
>> outcome (getting navigation timings).
>>
>> We *could* just monkey patch the execute_script method, but before I do,
>> Jari, is there a more elegant solution?
>>
>> module Watir
>>  class Browser
>>   def execute_script(script, *args)
>>    args.map! { |e| e.kind_of?(Watir::Element) ? e.wd : e }
>>    obj = @driver.execute_script(script, *args)
>>    obj.each { |k,v| obj[k] = wrap_elements_in(v) }
>>    obj
>>   end
>>  end
>> end
>
>
>
> Well, execute_script should already wrap instances of
> Selenium::WebDriver::Element in Watir::Element, so I'm not sure how that is
> happening.
>
>   https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/browser.rb#L122
>
> I don't really see how the monkey patch would help (e.g. it would break any
> script that doesn't return a Hash). Someone needs to get their hands on a
> Windows box in order to solve this I think :)
>
>
>>
>> --
>> 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

-- 
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: Watir Webdriver Performance Error

2011-12-08 Thread Jari Bakken
On Thu, Dec 8, 2011 at 3:36 AM, @90kts  wrote:

> Well it appears from the OP error that the return object
> of Browser#execute_script is a WebDriver::Element.. hence my code is
> failing as it expects a hash.
>
> I'm not sure why this is doing it on Win2K8 R2 with IE9, as I don't have
> that development platform... but it was tested on Win2K3 with IE9 as Chuck
> mentioned.
>
> I could just raise an error like Jari suggested, but that won't help the
> outcome (getting navigation timings).
>
> We *could* just monkey patch the execute_script method, but before I do,
> Jari, is there a more elegant solution?
>
> module Watir
>  class Browser
>   def execute_script(script, *args)
>args.map! { |e| e.kind_of?(Watir::Element) ? e.wd : e }
>obj = @driver.execute_script(script, *args)
>obj.each { |k,v| obj[k] = wrap_elements_in(v) }
>obj
>   end
>  end
> end
>


Well, execute_script should already wrap instances of
Selenium::WebDriver::Element in Watir::Element, so I'm not sure how that is
happening.


https://github.com/jarib/watir-webdriver/blob/master/lib/watir-webdriver/browser.rb#L122

I don't really see how the monkey patch would help (e.g. it would break any
script that doesn't return a Hash). Someone needs to get their hands on a
Windows box in order to solve this I think :)



>  --
> 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: Watir Webdriver Performance Error

2011-12-08 Thread Chuck van der Linden
I would gladly test this on a few platforms but my selection of handy
test VM's is greatly reduced these days as I am no longer working for
an MS gold level partner where I had a beefy Hyper-v server hosting a
wide variety of Win client and server OS's (all under MSDN licenses).
The current employer uses a Linux/Rails platform on the server side,
so my VM system are limited to client OS's needed to test the webUI.
So unfortunately I can't go back and try this on Server2003 using
latest webdriver, IE9 etc.

I did look at it on Win7 with current versions of Webdriver and IE9
and got the same error as the OP, so I can assure you the current
behavior he's seeing is not limited to the server OS being used.
(although there is a fair bit of shared shell code between 2008 and
Win7)

If there's anything more I can do to help, let me know

On Dec 7, 6:36 pm, "@90kts"  wrote:
> Well it appears from the OP error that the return object
> of Browser#execute_script is a WebDriver::Element.. hence my code is
> failing as it expects a hash.
>
> I'm not sure why this is doing it on Win2K8 R2 with IE9, as I don't have
> that development platform... but it was tested on Win2K3 with IE9 as Chuck
> mentioned.
>
> I could just raise an error like Jari suggested, but that won't help the
> outcome (getting navigation timings).
>
> We *could* just monkey patch the execute_script method, but before I do,
> Jari, is there a more elegant solution?
>
> module Watir
>  class Browser
>   def execute_script(script, *args)
>    args.map! { |e| e.kind_of?(Watir::Element) ? e.wd : e }
>    obj = @driver.execute_script(script, *args)
>    obj.each { |k,v| obj[k] = wrap_elements_in(v) }
>    obj
>   end
>  end
> end

-- 
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: Watir Webdriver Performance Error

2011-12-07 Thread @90kts
Well it appears from the OP error that the return object 
of Browser#execute_script is a WebDriver::Element.. hence my code is 
failing as it expects a hash.

I'm not sure why this is doing it on Win2K8 R2 with IE9, as I don't have 
that development platform... but it was tested on Win2K3 with IE9 as Chuck 
mentioned.

I could just raise an error like Jari suggested, but that won't help the 
outcome (getting navigation timings).

We *could* just monkey patch the execute_script method, but before I do, 
Jari, is there a more elegant solution?

module Watir
 class Browser
  def execute_script(script, *args)
   args.map! { |e| e.kind_of?(Watir::Element) ? e.wd : e }
   obj = @driver.execute_script(script, *args)
   obj.each { |k,v| obj[k] = wrap_elements_in(v) }
   obj
  end
 end
end

-- 
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: Watir Webdriver Performance Error

2011-12-06 Thread Chuck van der Linden
I suppose that is possible, however I think this gem was developed
using IE9 to start with, since it and Chrome were the first to support
the new standard for the performance info.  FF was the last one to
this particular party.  Since he makes reference to both browsers in
his blog posting, I'd not think Tom was the sort to have just tested
this with Chrome and called it good, I'd have expected he would have
tried it with both browsers.  So why would it have (we presume) been
working a few months ago and be broken now?

On Dec 6, 2:35 pm, Jari Bakken  wrote:
> It sounds like the execute_script call in IE9 is returning a DOM
> element instead of null or an object. Probably the gem should be
> stricter about type checking the returned value and raise an error if
> it's not what it expects.
>
> Den 6. des. 2011 kl. 22:50 skrev Chuck van der Linden :
>
>
>
>
>
>
>
> > I get the same error on Win7 running IE9, protected mode off, from an
> > admin level command prompt
>
> > even went so far as to use a local page, set to be a trusted site,
> > with my security  settings for trusted sites set to low.
>
> > Not sure what else I could lower security wise in order to let that
> > sucker run, so it may be some other error caused by newer version of
> > webdriver or something else.  (it could still be security, but if so,
> > what more could you relax to let it work?)
>
> > I can access the window.performance method from the developer tools
> > console on IE, so I know at least that much is present.
> > window.msPerformance  doesn't seem to do anything however some things
> > I am seeing seem to imply that perhaps that was an early prototype api
> > the MS was messing with and it might all have been just rolled into
> > window.performance now.
>
> > Using the same code against current Chrome and Firefox works fine,
> > it's only the IE9 that seems busted.
>
> > Taking either browser tohttp://webtimingdemo.appspot.com/works just
> > fine, and as far as I know, it uses the same performance API stuff
> > that the gem s trying to use.
>
> > The nature of the error (and that we are not seeing a warning that the
> > browser does not support performance metrics) would seem to indicate
> > that it's getting a null object back when it tries to get the
> > performance data (and then that fails in munge because the null object
> > doesn't have any methods defined, much less one for each_key) so it's
> > as if the code is making the call but just not getting anything back
> > which is a bit strange.
>
> > This might be a question that has to be addressed to someone at MS or
> > maybe the gem author to troubleshoot and figure out what is going
> > wrong.
>
> > The fact that you and I are both seeing it, under both Server2008 and
> > Win7 makes me wonder if there was perhaps some recent change in
> > webdriver that might be at fault?   I think this is going to take
> > someone with more knowledge in this area like TimK to chime in.
>
> > On Dec 6, 10:28 am, bis  wrote:
> >> well basically what you are trying to do with the gem is this
> >> driver.execute_script("return window.performance ||
> >> window.webkitPerformance || window.mozPerformance || 
> >> window.msPerformance;")
> >> and some formatting to give you the methods...
>
> >> and what it looks like is that the browser is not allowing you to perform
> >> that. I would check the security settings. you get this same errror when
> >> you run it against a browser that doesn't support webtimings. and since you
> >> are running on windows server its probably permission settings.
>
> >> 2011/12/6 Jason Shelton 
>
> >>>  I apologize, I did not realize the screenshot of the error was
> >>> insufficient. Below is the the text of the error:
>
> >>>  C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:15:in
> >>> 'munge': undefined method 'each_key' for
> >>> # 
>
> >>> from  
> >>> C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:90:in
> >>> 'performance'
>
> >>> Here is the code:
>
> >>> require 'watir-webdriver'
> >>> require 'watir-webdriver-performance'
>
> >>> b = Watir::Browser.new :ie
> >>> b.goto 'http://watir.com'
> >>> puts "Load Time: #{b.performance.summary[:response_time]/1000} seconds."
>
> >>> As I mentioned before, this error only occurs when I use IE 9 as the 
> >>> browser. I am using a Win Server 2008 R2 box. Thanks in advance for any 
> >>> assistance with this issue.
>
> >>> - Shelton
>
> >>> --
> >>> From: zeljko.fili...@wa-research.ch
> >>> Date: Tue, 6 Dec 2011 10:47:19 +0100
> >>> Subject: Re: [wtr-general] Watir Webdriver Performance Error
> >>> To: watir-general@googlegroups.com
>
> >>> On Tue, Dec 6, 2011 at 7:22 AM, Jason Shelton 
> >>> wrote:
>  I am getting the attached error
>
> >>> 1) Please copy/paste the text of the error. Let me know if you do not know
> >>> how to do that.
> >>> 2) Please provide the code

Re: [wtr-general] Re: Watir Webdriver Performance Error

2011-12-06 Thread Jari Bakken
It sounds like the execute_script call in IE9 is returning a DOM
element instead of null or an object. Probably the gem should be
stricter about type checking the returned value and raise an error if
it's not what it expects.

Den 6. des. 2011 kl. 22:50 skrev Chuck van der Linden :

> I get the same error on Win7 running IE9, protected mode off, from an
> admin level command prompt
>
> even went so far as to use a local page, set to be a trusted site,
> with my security  settings for trusted sites set to low.
>
> Not sure what else I could lower security wise in order to let that
> sucker run, so it may be some other error caused by newer version of
> webdriver or something else.  (it could still be security, but if so,
> what more could you relax to let it work?)
>
> I can access the window.performance method from the developer tools
> console on IE, so I know at least that much is present.
> window.msPerformance  doesn't seem to do anything however some things
> I am seeing seem to imply that perhaps that was an early prototype api
> the MS was messing with and it might all have been just rolled into
> window.performance now.
>
> Using the same code against current Chrome and Firefox works fine,
> it's only the IE9 that seems busted.
>
> Taking either browser to http://webtimingdemo.appspot.com/ works just
> fine, and as far as I know, it uses the same performance API stuff
> that the gem s trying to use.
>
> The nature of the error (and that we are not seeing a warning that the
> browser does not support performance metrics) would seem to indicate
> that it's getting a null object back when it tries to get the
> performance data (and then that fails in munge because the null object
> doesn't have any methods defined, much less one for each_key) so it's
> as if the code is making the call but just not getting anything back
> which is a bit strange.
>
> This might be a question that has to be addressed to someone at MS or
> maybe the gem author to troubleshoot and figure out what is going
> wrong.
>
> The fact that you and I are both seeing it, under both Server2008 and
> Win7 makes me wonder if there was perhaps some recent change in
> webdriver that might be at fault?   I think this is going to take
> someone with more knowledge in this area like TimK to chime in.
>
> On Dec 6, 10:28 am, bis  wrote:
>> well basically what you are trying to do with the gem is this
>> driver.execute_script("return window.performance ||
>> window.webkitPerformance || window.mozPerformance || window.msPerformance;")
>> and some formatting to give you the methods...
>>
>> and what it looks like is that the browser is not allowing you to perform
>> that. I would check the security settings. you get this same errror when
>> you run it against a browser that doesn't support webtimings. and since you
>> are running on windows server its probably permission settings.
>>
>> 2011/12/6 Jason Shelton 
>>
>>
>>
>>
>>
>>
>>
>>>  I apologize, I did not realize the screenshot of the error was
>>> insufficient. Below is the the text of the error:
>>
>>>  
>>> C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:15:in
>>> 'munge': undefined method 'each_key' for
>>> # 
>>
>>> from  
>>> C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:90:in
>>> 'performance'
>>
>>> Here is the code:
>>
>>> require 'watir-webdriver'
>>> require 'watir-webdriver-performance'
>>
>>> b = Watir::Browser.new :ie
>>> b.goto 'http://watir.com'
>>> puts "Load Time: #{b.performance.summary[:response_time]/1000} seconds."
>>
>>> As I mentioned before, this error only occurs when I use IE 9 as the 
>>> browser. I am using a Win Server 2008 R2 box. Thanks in advance for any 
>>> assistance with this issue.
>>
>>> - Shelton
>>
>>> --
>>> From: zeljko.fili...@wa-research.ch
>>> Date: Tue, 6 Dec 2011 10:47:19 +0100
>>> Subject: Re: [wtr-general] Watir Webdriver Performance Error
>>> To: watir-general@googlegroups.com
>>
>>> On Tue, Dec 6, 2011 at 7:22 AM, Jason Shelton 
>>> wrote:
 I am getting the attached error
>>
>>> 1) Please copy/paste the text of the error. Let me know if you do not know
>>> how to do that.
>>> 2) Please provide the code that caused the error.
>>
>>> Željko
>>> --
>>> watir.com/book - author
>>
>>> --
>>> 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 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@googlegr

[wtr-general] Re: Watir Webdriver Performance Error

2011-12-06 Thread Chuck van der Linden
I get the same error on Win7 running IE9, protected mode off, from an
admin level command prompt

even went so far as to use a local page, set to be a trusted site,
with my security  settings for trusted sites set to low.

Not sure what else I could lower security wise in order to let that
sucker run, so it may be some other error caused by newer version of
webdriver or something else.  (it could still be security, but if so,
what more could you relax to let it work?)

I can access the window.performance method from the developer tools
console on IE, so I know at least that much is present.
window.msPerformance  doesn't seem to do anything however some things
I am seeing seem to imply that perhaps that was an early prototype api
the MS was messing with and it might all have been just rolled into
window.performance now.

Using the same code against current Chrome and Firefox works fine,
it's only the IE9 that seems busted.

Taking either browser to http://webtimingdemo.appspot.com/ works just
fine, and as far as I know, it uses the same performance API stuff
that the gem s trying to use.

The nature of the error (and that we are not seeing a warning that the
browser does not support performance metrics) would seem to indicate
that it's getting a null object back when it tries to get the
performance data (and then that fails in munge because the null object
doesn't have any methods defined, much less one for each_key) so it's
as if the code is making the call but just not getting anything back
which is a bit strange.

This might be a question that has to be addressed to someone at MS or
maybe the gem author to troubleshoot and figure out what is going
wrong.

The fact that you and I are both seeing it, under both Server2008 and
Win7 makes me wonder if there was perhaps some recent change in
webdriver that might be at fault?   I think this is going to take
someone with more knowledge in this area like TimK to chime in.

On Dec 6, 10:28 am, bis  wrote:
> well basically what you are trying to do with the gem is this
> driver.execute_script("return window.performance ||
> window.webkitPerformance || window.mozPerformance || window.msPerformance;")
> and some formatting to give you the methods...
>
> and what it looks like is that the browser is not allowing you to perform
> that. I would check the security settings. you get this same errror when
> you run it against a browser that doesn't support webtimings. and since you
> are running on windows server its probably permission settings.
>
> 2011/12/6 Jason Shelton 
>
>
>
>
>
>
>
> >  I apologize, I did not realize the screenshot of the error was
> > insufficient. Below is the the text of the error:
>
> >  C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:15:in
> > 'munge': undefined method 'each_key' for
> > # 
>
> > from  
> > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-performance-0.1.3.1/lib/watir-webdriver-performance.rb:90:in
> > 'performance'
>
> > Here is the code:
>
> > require 'watir-webdriver'
> > require 'watir-webdriver-performance'
>
> > b = Watir::Browser.new :ie
> > b.goto 'http://watir.com'
> > puts "Load Time: #{b.performance.summary[:response_time]/1000} seconds."
>
> > As I mentioned before, this error only occurs when I use IE 9 as the 
> > browser. I am using a Win Server 2008 R2 box. Thanks in advance for any 
> > assistance with this issue.
>
> > - Shelton
>
> > --
> > From: zeljko.fili...@wa-research.ch
> > Date: Tue, 6 Dec 2011 10:47:19 +0100
> > Subject: Re: [wtr-general] Watir Webdriver Performance Error
> > To: watir-general@googlegroups.com
>
> > On Tue, Dec 6, 2011 at 7:22 AM, Jason Shelton 
> > wrote:
> > > I am getting the attached error
>
> > 1) Please copy/paste the text of the error. Let me know if you do not know
> > how to do that.
> > 2) Please provide the code that caused the error.
>
> > Željko
> > --
> > watir.com/book - author
>
> > --
> > 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 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