Re: [wtr-general] Re: click Div button

2011-03-03 Thread Сергей Демьянчук
Hi, vin

First, you have to make sure that expected event fires exactly after
clicking on the div element, and not on the another element, for example,
not after clicking on the image with src =
/gui-framework/images/FolderOpen.gif.
Also some times you have to use fireEvent instead of clicking on the
element. So please try something like this:

b.div(:id, configure_access_left).fireEvent(onmousedown)
  or
b.div(:id, ext-genits dynamic ID).fireEvent(onmousedown)

Also, agree with Željko could you please explain what do you mean saying:
not working ?

Thanks,
Sergii

2011/3/3 vin vinay...@gmail.com

 I need to use the first div which as static ID as
 configure_access_left:

 I have tried below methods but its not working:
 b.div(:id, configure_access_left).click
 b.div(:id, ext-gen236).click

 Also please let me know if i can make use of Access (marked ) to
 achieve required click operation?
 ###
 .div id=configure_access_left class=transparent x-abs-layout-item
 style=font-size: 11px; top: 6px;
 div id=ext-gen236 class=transparent-bwrap
 div id=ext-gen237 class=transparent-body transparent-body-
 noheader
 img id=010200 src=/gui-framework/images/FolderOpen.gif/
  Access  
 /div
 /div
 /div
 /div
 /div
 /div

 Thanks,

 --
 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.comhttp://groups.google.com/group/watir-general%0awatir-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] Watir day and Selenium Conf

2011-03-03 Thread Željko Filipin
Win a ticket to the Selenium Conference

http://blog.softwaretestingclub.com/2011/03/win-a-ticket-to-the-selenium-conference/

Željko

-- 
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: Test framework setup question (variables)

2011-03-03 Thread Anil
I usually keep them in a separate XML file, and read at run time. So
these can be changed easily without needing any change in the library.
I do not prefer to use spreadsheet for keeping variables, courtesy
being heavy and no straight mechanism to read from.

On Mar 2, 4:43 pm, xguarder shams...@gmail.com wrote:
 I am trying to restructure my automation code to emulate what I
 consider to be a great framework setup demonstrated by Alister Scott,
 as described here...

 http://watirmelon.com/2009/09/08/creating-a-watir-framework-using-tes...

 The one major difference is I won't be using a spreadsheet for any
 input data. Instead, I will have a few variables that will have to
 permeate throughout all tests and shared methods files (what is in the
 lib directory). These variables include things such as username,
 password, and domain, and currently, I have them declared as global
 variables in one of the shared lib files. Question is, I am trying to
 avoid having global variables, and am wondering if I don't make them
 global, where would the best place be for those? They need to be
 accessible anywhere, and they are subject to change, I'd like to
 declare them in only one location within one of the lib files for ease
 of maintenance. Is it best to keep them as global variables, or should
 they be class variables in one of the lib files (in which case I'm not
 sure how to inherit those variables from the test files).

 Thanks in advance!

-- 
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: viaqa Watir days

2011-03-03 Thread Željko Filipin
On Wed, Mar 2, 2011 at 8:35 AM, Dan Claudiu Pop danclaudiu...@gmail.com
wrote:
 I would like to come. I'm from Romania and San Francisco is too far
 away from me but Zagreb sounds very good.

I hope to see you in Zagreb! :)

Željko

-- 
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] How to Trace the change in a field

2011-03-03 Thread Ashu
hi,
there is a field on the php page that keeps track of the change in
counter field.
On every next refresh the value changes of that variable.
trtd class=normalChange counter/td
td class=normaldiv class=system1/div/td/tr
The 1 in the above code determines that one transaction has taken
place and it continues to increase up on every transaction update.
I am unable to figure out the logic to keep track of the change.

-- 
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: Need support in using POST method in RUBY

2011-03-03 Thread Danijel
Hi, in that way you can use solex by eclipse or similar tools, which
is checking a http traffic fom you page

br,Dani

On 2 mar., 07:22, Ashu ashay.n...@gmail.com wrote:
 Hi,
 I am making use of POST method to trace and element in a PHP file
 which needs to be automated. While trying to locate through the XPATH,
 watir was unable to locate the element as the page that was referenced
 was a PHP page.
 I would like to learn more on the POST parameters.
 resp, data = http.post(path, data, headers)
 As 'Content-Type' = 'text/xml'
 And what is data parameter?
 What should I assign to 'data' parameter?
 Thanks...

-- 
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: How to Trace the change in a field

2011-03-03 Thread Ashu
The xpath for the html
html  trtd class=normalcounter change/tdtd
class=normaldiv class=system1/div/td/tr

is xpath  /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/
td[2]/div

On Mar 3, 2:17 pm, Ashu ashay.n...@gmail.com wrote:
 hi,
 there is a field on the php page that keeps track of the change in
 counter field.
 On every next refresh the value changes of that variable.
 trtd class=normalChange counter/td
 td class=normaldiv class=system1/div/td/tr
 The 1 in the above code determines that one transaction has taken
 place and it continues to increase up on every transaction update.
 I am unable to figure out the logic to keep track of the change.

-- 
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: Need support in using POST method in RUBY

2011-03-03 Thread Danijel
In one way you can use watir-selenium , they have function

Selenium for Java [java] Checking network traffic,
https://mail.google.com/mail/?shva=1#inbox/12e77a83a1360d2d
you can read there about session data.

br,Dani

On 2 mar., 07:22, Ashu ashay.n...@gmail.com wrote:
 Hi,
 I am making use of POST method to trace and element in a PHP file
 which needs to be automated. While trying to locate through the XPATH,
 watir was unable to locate the element as the page that was referenced
 was a PHP page.
 I would like to learn more on the POST parameters.
 resp, data = http.post(path, data, headers)
 As 'Content-Type' = 'text/xml'
 And what is data parameter?
 What should I assign to 'data' parameter?
 Thanks...

-- 
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] Interact with Javascript Pop Up

2011-03-03 Thread Usman Hussain
Hi Guys,

Im doing a test at the moment where when I enter in something into the
url it brings up a Javascript pop up.
Now  I do not want to turn the pop up function off by writing some
Javascript and then using @b.execute_script etc...

What I would LIKE to do is to somehow interact with the javascript pop
up and click on the button to close it.
Is there any way i can do it using the Watir or Webdriver Api or
something?

The pop up is an ALERT box.
I am using a MAC
I am using Watir-Webdriver with Cucumber
Ruby v1.8.7

any more info please shout.
Any help would be awesome.

Kind regards,
Usman Hussain

-- 
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: Can Watir support PHP based technology?

2011-03-03 Thread Super Kevy
excellent:
To speed up your learning process look at the
1. api doc link: http://wtr.rubyforge.org/rdoc/1.6.5/
2. Bretts cheat sheet: 
http://pettichord.com/watirtutorial/docs/watir_cheat_sheet/WTR/Cheat%20Sheet.html
3. Watir home examples http://watir.com/examples/
4. Watir home docs http://watir.com/documentation/
http://wiki.openqa.org/display/WTR/Tutorial

I find newbies with any basic skill at programming can pick WATIR up
and be quite productive in a less then 2 weeks



On Mar 2, 2:08 am, Ashu ashay.n...@gmail.com wrote:
 Thanks alot...
 It was a very helpful reply from respected Super Key
 Looking at the time bound nature of the project, the above reply which
 actually worked out for me will be helpful in progressing ahead with
 the project.
 Thanks alot.
 I did observe that there are minor things that go overlooked which do
 cost us lot of time consumption.

 On Mar 2, 12:06 am, Super Kevy kpe...@scholarshipamerica.org wrote:



  First I'm glad you figured out whether php, java, ruby, asp it all
  plays in a browser as HTML.
  That should make your life easier. At some point go through the simple
  tutorials athttp://www.w3schools.com/

  Try this code fragment.  Your trying to click an image button within a
  form

  require 'rubygems'
  require 'watir'

  sURL='http://your_test_url.htm' # Change this to your URL
  browser = Watir::Browser.new
  browser.goto(sURL)
  sleep 3
  # The input button has a name attribute so we can use it as a handle
  browser.button(:name,'SDP_0_0').flash()  # MAKE ME FLASH a Yellow
  highlight
  sleep 3
  browser.button(:name,'SDP_0_0').click  # The actual click of the
  button
  puts 'DONE'

  On Feb 28, 12:46 pm, Chuck van der Linden sqa...@gmail.com wrote:

   On Feb 27, 8:44 pm, Ashu ashay.n...@gmail.com wrote:

Yes,
as the script is running on the IP address, so a webpage opens that is
in PHP.

Watir can detect the text that is written in td[2]
xpath - /html/body/div/div/div[5]/div/div[7]/table/tbody/tr/td[2]
But,
There is an image file in the input below
/html/body/div/div/div[6]/div/fieldset/table[2]/tbody/tr[3]/td[8]/
input
as
input type=image halign=right valign=middle title=Open SDP
file alt=Open SDP file src=main.php_files/play-icon-big.png
name=SDP_0_0

So on clicking on that image file an event occurs.
But it needs to be automated.
Please Help.
Thanks!

   What have you tried so far?  what if any results did you get?

   you realize it's not our job to write your code for you?- Hide quoted 
   text -

   - Show quoted text -- Hide quoted text -

 - Show quoted text -

-- 
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: Is there a 1.8.0 equivalent of Watir::Waiter.wait_until?

2011-03-03 Thread chsonnu
Well a little more hackish of a solution than I thought it'd be but
I'll give a shot.  Thanks orde.

On Mar 2, 3:59 pm, orde ohil...@gmail.com wrote:
 I'm using watir 1.7.1, but there are 2 files named wait.rb and
 element_extensions.rb (in *\commonwatir-1.7.1\lib\watir), which
 contain the Wait and ElementExtensions modules.

 These modules contain the method(s) that you want (i.e. the .until
 method).

 orde

 On Mar 2, 12:05 pm, chsonnu chso...@gmail.com wrote:

  Using Watir::Waiter.wait_until in 1.8.0 causes this message to
  display:

  Using Watir::Waiter is DEPRECATED and will be removed in some newer
  version of Watir! Use Watir::Wait and Watir::ElementExtensions methods
  instead!

  I'm assuming the message isn't valid since Watir::Wait and
  Watir::ElementExtensions no longer exist.  What should we be using
  instead?

-- 
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] Interact with Javascript Pop Up

2011-03-03 Thread Jari Bakken
On Thu, Mar 3, 2011 at 2:12 PM, Usman Hussain usmanhhuss...@gmail.com wrote:
 Hi Guys,

 Im doing a test at the moment where when I enter in something into the
 url it brings up a Javascript pop up.
 Now  I do not want to turn the pop up function off by writing some
 Javascript and then using @b.execute_script etc...

 What I would LIKE to do is to somehow interact with the javascript pop
 up and click on the button to close it.
 Is there any way i can do it using the Watir or Webdriver Api or
 something?

 The pop up is an ALERT box.
 I am using a MAC
 I am using Watir-Webdriver with Cucumber
 Ruby v1.8.7

 any more info please shout.
 Any help would be awesome.


There are two ways to do this:

1. Use watir-webdriver's execute_script hacks:

  require 'watir-webdriver/extensions/alert'

  browser.alert do
# perform action that triggers alert
  end

See https://github.com/jarib/watir-webdriver/blob/master/spec/alert_spec.rb
for more examples.

2. Use WebDriver's alert handling API directly (currently Firefox-only
and considered experimental)

  # perform action that triggers alert
  browser.driver.switch_to.alert.accept

More examples of this here
http://code.google.com/p/selenium/source/browse/trunk/rb/spec/integration/selenium/webdriver/target_locator_spec.rb#97

Jari

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

2011-03-03 Thread Chuck van der Linden
'access'  appears to be text..  do you see it on the page as text next
to a 'FolderOpen image?  Is that text unique on the screen, or does
it appear in other places as well?

The problem we are faced with here is that there are several
overlapping HTML elements here, and none of the HTML types used here
are normally 'reactive' on their own to being clicked.  (as opposed to
an input type such as a button)   So there is somewhere that we
cannot see here, behind the scenes 'plumbing' that sets up some of
those elements to be sensitive to specific events, and run specific
javscript when the events occur.  I suspect this is configured at a
class or style level, but unless you really want to dig around in the
controls code that doesn't much matter.  The issue is that of this
sort of 'stack' of elements, we don't know which one is responsive to
the click.. furthermore we don't know if it's looking for onclick,
onmousedown, onmouseup, or whatever.

What you have going in your favor is you know the ID of the outer
container, whcih makes it easier to try and click on it, OR one of the
inner ones..

You've got (periods used to force spacing)

div id=configure_access_left class=transparent x-abs-layout-item
style=font-size: 11px; top: 6px;
. .div id=ext-gen236 class=transparent-bwrap
. . . div id=ext-gen237 class=transparent-body transparent-body-
noheader
. . . . img id=010200 src=/gui-framework/images/FolderOpen.gif/
. . . .  Access
. . . /div

What I would do is mess around using IRB to try clicking on each of
these in turn using something like what I have below, and see if just
a basic click on one of these works.

browser.div(:id, configure_access_left).click
browser.div(:id, configure_access_left).div(:class, transparent-
bwrap).click
browser.div(:id, configure_access_left).div(:class, transparent-
body transparent-body-noheader).click
browser.div(:id, configure_access_left).img(:src, /gui-framework/
images/FolderOpen.gif).click

The ones after the first are effectively saying 'look inside the div
with the id configure_access_left and find the div with class  and
click on it)  notice that you don't need to specify the entire path or
nesting as you would with xpath.  All that is needed is enough UNIQUE
identifiers (or a combination that is unique) for watir to find the
element you want.

If that doesn't work, then you may have to try firing events such as
onmousedown or onmouseup in place of the click.

The other thing I'd strongly suggest is perhaps contacting the support
folks for EXTJS, explain you are trying to automate testing of the
site using their controls, and see if they can tell you what event (or
sequence of events) needs to be fired at which class of divs in order
to effect a 'click'

On Mar 2, 9:52 pm, vin vinay...@gmail.com wrote:
 I need to use the first div which as static ID as
 configure_access_left:

 I have tried below methods but its not working:
 b.div(:id, configure_access_left).click
 b.div(:id, ext-gen236).click

 Also please let me know if i can make use of Access (marked ) to
 achieve required click operation?
 ###
 .div id=configure_access_left class=transparent x-abs-layout-item
 style=font-size: 11px; top: 6px;
 div id=ext-gen236 class=transparent-bwrap
 div id=ext-gen237 class=transparent-body transparent-body-
 noheader
 img id=010200 src=/gui-framework/images/FolderOpen.gif/
  Access  
 /div
 /div
 /div
 /div
 /div
 /div

 Thanks,

-- 
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: How to Trace the change in a field

2011-03-03 Thread orde
Find a way to determine the value of div class=system and assign
it to a variable.


On Mar 3, 1:35 am, Ashu ashay.n...@gmail.com wrote:
 The xpath for the html
 html  trtd class=normalcounter change/tdtd
 class=normaldiv class=system1/div/td/tr

 is xpath  /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/
 td[2]/div

 On Mar 3, 2:17 pm, Ashu ashay.n...@gmail.com wrote:







  hi,
  there is a field on the php page that keeps track of the change in
  counter field.
  On every next refresh the value changes of that variable.
  trtd class=normalChange counter/td
  td class=normaldiv class=system1/div/td/tr
  The 1 in the above code determines that one transaction has taken
  place and it continues to increase up on every transaction update.
  I am unable to figure out the logic to keep track of the change.

-- 
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: can't correctly excute onchange event when I use select_list#select

2011-03-03 Thread Chuck van der Linden
have you tried scripting a firing of the onchange event against the
element after you have done the select?

browser.frame(mainFrame).select_list(:name,servname).fire_event(onchange)

On Mar 2, 6:52 pm, WinDy lyfi2...@sina.com wrote:
 I have a web page to test.

 The page like this:

 select name=servname onchange=javascript:changeServSelect();  
 .../select

 select name=appname onchange=javascript:ChangeAppSelect();../select

 other...

 When I select something on the first select_tag, The second one' values  
 will be changed.

 But When I select it using watir( watir1.6.5 ,watir1.7.1 watir1.8.0) :

 browser.frame(mainFrame).select_list(:name,servname).select(HTTP)

 I find the second one's values are cleanup. It appears that 'onchange'  
 event function executes wrong in watir !

 some code may be useful:

 changeServSelect function 'code

 function ChangeServSelect()
 {
 document.all('appname').options.length=0;
 var index = document.all('servname').selectedIndex;
 if(index = 0)
 {
 var servvalue = 
 document.all('hideservvalues').options[index].value;
 var servArray = servvalue.split(?);
 var len = 0;
 for(; len  servArray.length; len = len + 1)
 {
 var appArray = servArray[len].split(!);
 document.all('appname').add(new Option(appArray[0], 
 appArray[0]));
 }
 ChangeAppSelect();
 }

 }

 ChangeAppSelect:

 function ChangeAppSelect()
 {
  document.all('subdividetype').options.length=0;
  var servindex = document.all('servname').selectedIndex;
  var appindex = document.all('appname').selectedIndex;
  if(servindex = 0)
  {
  var servvalue =  
 document.all('hideservvalues').options[servindex].value;
  var servArray = servvalue.split(?);
  var appArray = servArray[appindex].split(!);
  if(appArray.length=1)
 
 document.getElementById('subdividetype').style.display=none;
  else
  {
 document.getElementById('subdividetype').style.display=;
 for(var len=1; len  appArray.length; len = len + 1)
  document.all('subdividetype').add(new 
 Option(appArray[len],  
 appArray[len]));
  }
  }

 }

 i'm sorry that i can't upload my whole page.

 thanks for your help at all.

 --
 使用 Opera 革命性的电子邮件客户程序:http://www.opera.com/mail/

-- 
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: How to Trace the change in a field

2011-03-03 Thread Ashu
ya I agree with Orde

well my testing page contains multiple tr with same class = normal
and div contains class = system for every tr

On Mar 3, 10:27 am, orde ohil...@gmail.com wrote:
 Find a way to determine the value of div class=system and assign
 it to a variable.

 On Mar 3, 1:35 am, Ashu ashay.n...@gmail.com wrote:

  The xpath for the html
  html  trtd class=normalcounter change/tdtd
  class=normaldiv class=system1/div/td/tr

  is xpath  /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/
  td[2]/div

  On Mar 3, 2:17 pm, Ashu ashay.n...@gmail.com wrote:

   hi,
   there is a field on the php page that keeps track of the change in
   counter field.
   On every next refresh the value changes of that variable.
   trtd class=normalChange counter/td
   td class=normaldiv class=system1/div/td/tr
   The 1 in the above code determines that one transaction has taken
   place and it continues to increase up on every transaction update.
   I am unable to figure out the logic to keep track of the change.

-- 
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] Cyrillic URLs

2011-03-03 Thread Smoke
 Currently such things become more and more popular.
 At the page there're links like : a href=ФорумФорум/a

 i'm trying : browser.link(:text, Форум).click

Result:
C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.8.0/lib/firewatir/
element.rb:922:i
n `assert_exists': Unable to locate element, using :text,
\324\356\360\363\354
 (Watir::Exception::UnknownObjectException)
from C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.8.0/lib/
firewatir/ele
ment.rb:1081:in `click'
from C:/Ruby187/bin/UkrCanter/1.rb:11

same with 'browser.link(:href, Форум).click'

-- 
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] Cyrillic URLs

2011-03-03 Thread Željko Filipin
On Thu, Mar 3, 2011 at 11:48 PM, Smoke 4sm...@gmail.com wrote:
 n `assert_exists': Unable to locate element, using :text,
 \324\356\360\363\354

I such cases I usually ask Ruby what he thinks text or href is, using some
attribute that I can access, or index if nothing else works.

Example:

browser.link(:index = 1).text
browser.link(:index = 1).href

Whatever you get back, you can use it to access the element.

I have also heard that firewatir has problems with UTF-8 characters, so I
would try with another gem too, just to make sure it is not firewatir
specific.

Željko
--
watir.com - community manager
watirpodcast.com - host
testingpodcast.com - audio podcasts on software testing. all of them
viaqa.mobi conference on software testing - organizer

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