[wtr-general] Re: Measure response time with fireEvent(onmouseup)

2011-03-17 Thread vin
Hi Guys,

Debugging further shows that with sleep the response time and bytes
recieved are proper but when sleep is removed the time and recieved
bytes are zero. Also, without sleep navigation to multiple pages
is very fast (script will not wait until page is laoded).

Script with sleep:
-
plugin.Clear()
plugin.Log.EnableFilter(false)
plugin.Record()
ie.div(:id, configure_access_left).fireEvent(onmouseup)   1st
page
sleep 10  
ie.div(:id, configure_nat_left).fireEvent(onmouseup)  2nd page
sleep 10  
plugin.Stop()
if plugin.Log.Pages.Count != 0
page1= plugin.Log.Pages(0).Entries.Summary
printf Total time to load page (secs):  %.3f\n, page1.Time
printf Number of bytes received on network: %d\n,
page1.BytesReceived

end

## output with sleep

Total time to load page (secs):  5.199
Number of bytes received on network: 427

##Script without Sleep


ie.div(:id, configure_access_left).fireEvent(onmouseup)   1st
page
ie.div(:id, configure_nat_left).fireEvent(onmouseup)  2nd page
plugin.Stop()

#ouptput:
-
Total time to load page (secs):  0.002
Number of bytes received on network: 0

Kindly let me know the cause for this behaviour and also better
solution to use for page to laod before navigation to next page.


On Mar 17, 1:06 am, vin vinay...@gmail.com wrote:
 Hi,

 I am using fireevent to click a div (button to navigate to a page) as
 shown:
 (ie.div(:id, configure_access_left).fireEvent(onmouseup)
 ###
 irb(main):004:0* b = Watir::Browser.new
 = #Watir::IE:0x287a2d0 url=about:blank title=
 irb(main):005:0
 irb(main):006:0* b.goto http://abc-blue;
 = 1.96875                         shows time
 irb(main):007:0 b.div(:id,
 configure_access_left).fireEvent(onmouseup)
 =
 nil
  shows as nill
 irb(main):008:0

 By using above method, navigate to a required page is achieved but the
 response shows as nil instead of the time. The scenario is server-
 client and upon navigation to a page client will fetch the data from
 the server. Here is the snippet captured with firebug:

 POSThttp://abc-blue/jsdm/ajax/access.php200 OK 571ms
 sajax(line 150)
 ParamsHeadersPostPutResponseCacheHTMLXML
 Response Headersview source
 Date    Thu, 17 Mar 2011 04:57:44 GMT
 Server  Mbedthis-Appweb/2.4.0
 Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-
 check=0
 Content-Type    text/xml; charset=UTF-8
 Etag    1368cc-296f-503300
 Content-Length  35
 Connection      keep-alive
 Keep-Alive      timeout=60, max=95
 X-Powered-By    PHP/5.3.2
 Expires Thu, 19 Nov 1981 08:52:00 GMT
 Pragma  no-cache
 Request Headersview source
 Host    srx-blue
 User-Agent      Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
 1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)
 Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
 Accept-Language en-us,en;q=0.5
 Accept-Encoding gzip,deflate
 Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
 Keep-Alive      115
 Connection      keep-alive
 Method  POST /jsdm/ajax/access.php HTTP/1.1
 Content-Type    application/x-www-form-urlencoded; charset=UTF-8
 Refererhttp://abc-blue/login

 Please let me know if i can achieve it from any other method.

 Thanks,
 Vin

-- 
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] Click on links on a dynamic pane

2011-03-17 Thread Basim Baassiri
When you say click on the action, do you use click method or do you use
fire_event ?

On Thu, Mar 17, 2011 at 11:13 AM, Aravind aravindredd...@gmail.com wrote:

 Hi

 This is the continuation of my previous question which is resolved.

 I have some links with the name action in the1st column of all the
 rows in a table.
 When I click the action link a dynamic pane will be displayed with few more
 links.
 Now i have click on any of the links on the pane.

 The image of the page and the html is attached.

 Please help.

 thanks
 aravind


 --
 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] Click on links on a dynamic pane

2011-03-17 Thread Aravind
Basim

I used Click method

thanks
aravind



On Thu, Mar 17, 2011 at 8:51 PM, Basim Baassiri ba...@baassiri.ca wrote:

 When you say click on the action, do you use click method or do you use
 fire_event ?

   On Thu, Mar 17, 2011 at 11:13 AM, Aravind aravindredd...@gmail.comwrote:

   Hi

 This is the continuation of my previous question which is resolved.

 I have some links with the name action in the1st column of all the
 rows in a table.
 When I click the action link a dynamic pane will be displayed with few
 more links.
 Now i have click on any of the links on the pane.

 The image of the page and the html is attached.

 Please help.

 thanks
 aravind


 --
 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] Click on links on a dynamic pane

2011-03-17 Thread Basim Baassiri
Without seeing the code that you have tried, i would recommend fire_event
onmouseover to trigger the menu and the fire_event on the link you want to
click from the actions menu

On Thu, Mar 17, 2011 at 11:25 AM, Aravind aravindredd...@gmail.com wrote:

 Basim

 I used Click method

 thanks
 aravind



 On Thu, Mar 17, 2011 at 8:51 PM, Basim Baassiri ba...@baassiri.ca wrote:

 When you say click on the action, do you use click method or do you use
 fire_event ?

   On Thu, Mar 17, 2011 at 11:13 AM, Aravind aravindredd...@gmail.comwrote:

   Hi

 This is the continuation of my previous question which is resolved.

 I have some links with the name action in the1st column of all the
 rows in a table.
 When I click the action link a dynamic pane will be displayed with few
 more links.
 Now i have click on any of the links on the pane.

 The image of the page and the html is attached.

 Please help.

 thanks
 aravind


 --
 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


-- 
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: Measure response time with fireEvent(onmouseup)

2011-03-17 Thread Chuck van der Linden
I think the issue is that since it's being invoked by client-side
code, watir doesn't really know to expect a page load at that time

Have you by any chance tried to click that div as if it was a button,
using the ID to identify it?

Since I see some ajax in there, I guess the first question is, is the
system truely re-loading the page, or is it just updating it?  In
other words, does the browser actually act like a page is loading,
does it ever say anything but 'done' in the status bar?  do you see
any of the 'animations' done by the browser to indicate a page is
being loaded?   If it is only updating portions of the page, it makes
getting a load time a lot harder.

It's been a while since I've played with this (since I needed to) but
I could swear that in the past Watir was a little less obsessive about
elements exactly matching the specific element type when you were
identifying them by ID (I think the logic was that since there should
be only ONE thing on that page with that id value, if we found one, it
must be the one you wanted).

b.button(:id, configure_access_left).click

The reason I say that is that doing that might cause watir to do it's
normal 'wait for the page to load' thing.   I'm not sure, but it might
be worth a shot.

(that or adding that command right after the one that does the mouseup
event, instead of a sleep)

Instead of sleeps, read up on waiting with watir.. in cases like this
it's sometimes easier to just have a small loop that waits for a
expected object to exist within the page, as an indication you are
ready to proceed.  (or conversely if the app displays some kind of
'loading' icon, you wait for that to go away)

On Mar 17, 3:29 am, vin vinay...@gmail.com wrote:
 Hi Guys,

 Debugging further shows that with sleep the response time and bytes
 recieved are proper but when sleep is removed the time and recieved
 bytes are zero. Also, without sleep navigation to multiple pages
 is very fast (script will not wait until page is laoded).

 Script with sleep:
 -
 plugin.Clear()
 plugin.Log.EnableFilter(false)
 plugin.Record()
 ie.div(:id, configure_access_left).fireEvent(onmouseup)   1st
 page
 sleep 10          
 ie.div(:id, configure_nat_left).fireEvent(onmouseup)  2nd page
 sleep 10          
 plugin.Stop()
 if plugin.Log.Pages.Count != 0
         page1= plugin.Log.Pages(0).Entries.Summary
         printf Total time to load page (secs):      %.3f\n, page1.Time
         printf Number of bytes received on network: %d\n,
 page1.BytesReceived

 end

 ## output with sleep

 Total time to load page (secs):      5.199
 Number of bytes received on network: 427

 ##Script without Sleep
 

 ie.div(:id, configure_access_left).fireEvent(onmouseup)   1st
 page
 ie.div(:id, configure_nat_left).fireEvent(onmouseup)  2nd page
 plugin.Stop()
 
 #ouptput:
 -
 Total time to load page (secs):      0.002
 Number of bytes received on network: 0

 Kindly let me know the cause for this behaviour and also better
 solution to use for page to laod before navigation to next page.

 On Mar 17, 1:06 am, vin vinay...@gmail.com wrote:

  Hi,

  I am using fireevent to click a div (button to navigate to a page) as
  shown:
  (ie.div(:id, configure_access_left).fireEvent(onmouseup)
  ###
  irb(main):004:0* b = Watir::Browser.new
  = #Watir::IE:0x287a2d0 url=about:blank title=
  irb(main):005:0
  irb(main):006:0* b.goto http://abc-blue;
  = 1.96875                         shows time
  irb(main):007:0 b.div(:id,
  configure_access_left).fireEvent(onmouseup)
  =
  nil
   shows as nill
  irb(main):008:0

  By using above method, navigate to a required page is achieved but the
  response shows as nil instead of the time. The scenario is server-
  client and upon navigation to a page client will fetch the data from
  the server. Here is the snippet captured with firebug:

  POSThttp://abc-blue/jsdm/ajax/access.php200OK 571ms
  sajax(line 150)
  ParamsHeadersPostPutResponseCacheHTMLXML
  Response Headersview source
  Date    Thu, 17 Mar 2011 04:57:44 GMT
  Server  Mbedthis-Appweb/2.4.0
  Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-
  check=0
  Content-Type    text/xml; charset=UTF-8
  Etag    1368cc-296f-503300
  Content-Length  35
  Connection      keep-alive
  Keep-Alive      timeout=60, max=95
  X-Powered-By    PHP/5.3.2
  Expires Thu, 19 Nov 1981 08:52:00 GMT
  Pragma  no-cache
  Request Headersview source
  Host    srx-blue
  User-Agent      Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
  1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)
  Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language en-us,en;q=0.5
  Accept-Encoding gzip,deflate
  Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
  Keep-Alive      115
  Connection      keep-alive
  Method  POST /jsdm/ajax/access.php HTTP/1.1
  Content-Type    application/x-www-form-urlencoded; charset=UTF-8
  Refererhttp://abc-blue/login

  Please let me 

[wtr-general] Re: Click on links on a dynamic pane

2011-03-17 Thread Chuck van der Linden
Can you show me the code for the click?

from the looks of the dom, the original link you click to see the sub-
menu, and those menu items, are all 'inside' that table row.   I
suspect that the challeng is that there are other similar hidden links
(at that point) on each of the other table rows, all with the same
link text etc..   Making clicking the right one a challenge;

So you might be able to identify them according to a sibling
relationship with the link you clicked

 Try using the same code as for the click, but replace the .click with
the following

 .parent.link(:text, Open This Version).click

as Basim indicated, you may have to FIRST fire an onmouseover event
against that element, since I see code in there that is reacting to
that event, and perhaps if it does not see that first, you won't be
able to click it

On Mar 17, 8:25 am, Aravind aravindredd...@gmail.com wrote:
 Basim

 I used Click method

 thanks
 aravind

 On Thu, Mar 17, 2011 at 8:51 PM, Basim Baassiri ba...@baassiri.ca wrote:
  When you say click on the action, do you use click method or do you use
  fire_event ?

    On Thu, Mar 17, 2011 at 11:13 AM, Aravind aravindredd...@gmail.comwrote:

    Hi

  This is the continuation of my previous question which is resolved.

  I have some links with the name action in the1st column of all the
  rows in a table.
  When I click the action link a dynamic pane will be displayed with few
  more links.
  Now i have click on any of the links on the pane.

  The image of the page and the html is attached.

  Please help.

  thanks
  aravind

  --
  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


Re: [wtr-general] Re: Measure response time with fireEvent(onmouseup)

2011-03-17 Thread Tim Koopmans
What is that plugin class ?

Regards,
Tim 

Sent from my mobile ...


On 17/03/2011, at 9:29 PM, vin vinay...@gmail.com wrote:

 Hi Guys,
 
 Debugging further shows that with sleep the response time and bytes
 recieved are proper but when sleep is removed the time and recieved
 bytes are zero. Also, without sleep navigation to multiple pages
 is very fast (script will not wait until page is laoded).
 
 Script with sleep:
 -
 plugin.Clear()
 plugin.Log.EnableFilter(false)
 plugin.Record()
 ie.div(:id, configure_access_left).fireEvent(onmouseup)   1st
 page
 sleep 10  
 ie.div(:id, configure_nat_left).fireEvent(onmouseup)  2nd page
 sleep 10  
 plugin.Stop()
 if plugin.Log.Pages.Count != 0
page1= plugin.Log.Pages(0).Entries.Summary
printf Total time to load page (secs):  %.3f\n, page1.Time
printf Number of bytes received on network: %d\n,
 page1.BytesReceived
 
 end
 
 ## output with sleep
 
 Total time to load page (secs):  5.199
 Number of bytes received on network: 427
 
 ##Script without Sleep
 
 
 ie.div(:id, configure_access_left).fireEvent(onmouseup)   1st
 page
 ie.div(:id, configure_nat_left).fireEvent(onmouseup)  2nd page
 plugin.Stop()
 
 #ouptput:
 -
 Total time to load page (secs):  0.002
 Number of bytes received on network: 0
 
 Kindly let me know the cause for this behaviour and also better
 solution to use for page to laod before navigation to next page.
 
 
 On Mar 17, 1:06 am, vin vinay...@gmail.com wrote:
 Hi,
 
 I am using fireevent to click a div (button to navigate to a page) as
 shown:
 (ie.div(:id, configure_access_left).fireEvent(onmouseup)
 ###
 irb(main):004:0* b = Watir::Browser.new
 = #Watir::IE:0x287a2d0 url=about:blank title=
 irb(main):005:0
 irb(main):006:0* b.goto http://abc-blue;
 = 1.96875 shows time
 irb(main):007:0 b.div(:id,
 configure_access_left).fireEvent(onmouseup)
 =
 nil
  shows as nill
 irb(main):008:0
 
 By using above method, navigate to a required page is achieved but the
 response shows as nil instead of the time. The scenario is server-
 client and upon navigation to a page client will fetch the data from
 the server. Here is the snippet captured with firebug:
 
 POSThttp://abc-blue/jsdm/ajax/access.php200 OK 571ms
 sajax(line 150)
 ParamsHeadersPostPutResponseCacheHTMLXML
 Response Headersview source
 DateThu, 17 Mar 2011 04:57:44 GMT
 Server  Mbedthis-Appweb/2.4.0
 Cache-Control   no-store, no-cache, must-revalidate, post-check=0, pre-
 check=0
 Content-Typetext/xml; charset=UTF-8
 Etag1368cc-296f-503300
 Content-Length  35
 Connection  keep-alive
 Keep-Alive  timeout=60, max=95
 X-Powered-ByPHP/5.3.2
 Expires Thu, 19 Nov 1981 08:52:00 GMT
 Pragma  no-cache
 Request Headersview source
 Hostsrx-blue
 User-Agent  Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:
 1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729)
 Accept  text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
 Accept-Language en-us,en;q=0.5
 Accept-Encoding gzip,deflate
 Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
 Keep-Alive  115
 Connection  keep-alive
 Method  POST /jsdm/ajax/access.php HTTP/1.1
 Content-Typeapplication/x-www-form-urlencoded; charset=UTF-8
 Refererhttp://abc-blue/login
 
 Please let me know if i can achieve it from any other method.
 
 Thanks,
 Vin
 
 -- 
 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: Click on the link in a cell of a table

2011-03-17 Thread Chuck van der Linden
On Mar 17, 5:41 am, Aravind aravindredd...@gmail.com wrote:
 thanks for the suggestion and this is the code i used

 def clickaction(table_id)
   table = $b.table(:id,table_id)
   if table.row_count  2
     for i in 3..table.row_count - 1
       if table[i][8].text == APV
          table[i][1].link(:index,1).click
       end
     end
   end
 end

Perhaps we can clean that up a little.

If APV appears nowhere else in the table as the contents of a single
cell, then you could try

If browser.table(:id, table_id).cell(:text, APV).exists?
  browser.table(:id, table_id).cell(:text, APV).parent.link(:index,
1).click
end

Parent should in that case give you the row that contains that cell,
and if the link is the first link in the first cell, then it should be
the first link in the row.

If APV can appear more than once, and you just want the first one in
any case then

If browser.table(:id, table_id).cell(:text = APV, :index =
1).exists?
  browser.table(:id, table_id).cell:text = APV, :index =
1).parent.link(:index, 1).click
end

Give it a try from IRB and see if that works.

-- 
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] Firewatir .element_name is always empty

2011-03-17 Thread Trampus Richmond
When using Firewatir I try to get the element_name from an instance an
element an I always get retuned an empty string.  This seems to be the cause
for firewatir-1.8.0, on both windows and Linux.

I really need to get at the jssh var name for the given firewatir element.

Simple Ruby Example:
Watir::Browser.default = firefox
b = Watir::Browser.new()
b.goto(file://c:/test-css.html)
div = b.div(:id, 6)
print Div: #{div.element_name}\n
btn = b.button(:id, button_666)
print Button: #{btn.element_name}\n
b.close()


Simple HTML target:
html
style type=text/css
.tbutton {
   color: #FF;
   background-color: #00;
   font-weight: bold;
}
/style
titletest css/title
body
   input class=tbutton type=button id=button_666 value=button-666
div id=6
   input class=tbutton type=button id=button_66q value=button-666
/div
/body
/html

-- 
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] Firewatir .element_name is always empty

2011-03-17 Thread Trampus Richmond
Looks like I was able to get at it using: div.class_eval(@element_name)


On 3/17/11 3:43 PM, Trampus Richmond trichm...@sugarcrm.com wrote:

When using Firewatir I try to get the element_name from an instance an
element an I always get retuned an empty string.  This seems to be the cause
for firewatir-1.8.0, on both windows and Linux.

I really need to get at the jssh var name for the given firewatir element.

Simple Ruby Example:
Watir::Browser.default = firefox
b = Watir::Browser.new()
b.goto(file://c:/test-css.html)
div = b.div(:id, 6)
print Div: #{div.element_name}\n
btn = b.button(:id, button_666)
print Button: #{btn.element_name}\n
b.close()


Simple HTML target:
html
style type=text/css
.tbutton {
   color: #FF;
   background-color: #00;
   font-weight: bold;
}
/style
titletest css/title
body
   input class=tbutton type=button id=button_666 value=button-666
div id=6
   input class=tbutton type=button id=button_66q value=button-666
/div
/body
/html

--
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