[wtr-general] Re: Contains Text

2011-03-07 Thread Soori
Hi Wesley,

It is not searching the full text. It returns true if the page has
"My" or "Engineering".

I want to search the exact match "My Engineering Services".

Thanks,
Soori


On Mar 7, 12:28 pm, Wesley Chen  wrote:
> You may try: ie.text.include?(***)
>
> Wesley.
> For life, the easier, the better.
>
>
>
>
>
>
>
> On Mon, Mar 7, 2011 at 1:18 PM, Soori  wrote:
> > All,
>
> > I would like to search for a text "My Engineering Services" on a
> > webpage. This can be a link too.
>
> > Should I use contains_text method or text_include method?
>
> > Please advice.
>
> > /soori
>
> > --
> > 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


[wtr-general] Re: How to Trace the change in a field

2011-03-07 Thread Ashu
Yes, you are right Chunk,
My HTML code looks like this -
/html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/Change counter0

I have tried as suggested by you,
It gives me following error...
C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/
jssh_socket.rb:12:in `const_get': wrong number of arguments (2 for 1)
(ArgumentError)
from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/
firewatir/jssh_socket.rb:12:in `js_eval'
from C:/Ruby186/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/
firewatir/element.rb:997:in `text'
from C:/Documents and Settings/tcsadmin/Desktop/
check_changecounter.rb:9


On Mar 4, 10:23 pm, Chuck van der Linden  wrote:
> If I read you correctly, the challenge is "get the contents of the
> second cell on the table row where the first cell is 'change counter'"
> is that right?
>
> Presuming that "change counter" appears nowhere else in that table,
> AND that you have some way to identify the table itself, or a
> container that holds the table
>
> browser.table(:how, "what").row(:text, /counter change/).cell(:index,
> 2).text
>
> if there is no other row in any other table that contains 'counter
> change' then you might even be able to do it by going straight to the
> row and not worrying about the table element.
>
> browser.row(:text, /counter change/).cell(:index, 2).text
>
> To understand why that works, do some googling and reading about
> something called 'regular expressions'
>
> PS  for challenges like this, a tiny bit more of the HTML such as
> details on the table, can be useful in terms of people being able to
> give you better examples of the code you would need to use.   The more
> details you put into a question on the group, the more likely you are
> to get a more 'exact' answer instead of a generic one.
>
> On Mar 3, 10:57 am, Ashu  wrote:
>
> > ya I agree with Orde
>
> > well my testing page contains multiple "" with same class = normal
> > and div contains class = system for every ""
>
> > On Mar 3, 10:27 am, orde  wrote:
>
> > > Find a way to determine the value of  and assign
> > > it to a variable.
>
> > > On Mar 3, 1:35 am, Ashu  wrote:
>
> > > > The xpath for the html
> > > > html  counter change > > > class="normal">1
>
> > > > 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  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.
> > > > > Change counter
> > > > > 1
> > > > > 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


Re: [wtr-general] Re: Recent Stack Overflow Questions Tagged Watir

2011-03-07 Thread Željko Filipin
http://stackoverflow.com/questions/5209074/printing-with-ruby-in-firefox

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

2011-03-07 Thread Mattias Karlsson
Hi, we have tried both options, the first one doesn't seem to find the
popup window when it is invoked by the browser directly, testing xss
vulnerability, instead of when invoking it in markup. For example, I
am trying this:

1)
  returned = @browser.alert do
@browser.goto('http://
www.url.com/"+void(document.cookie="authorization=true")+alert(document.cookie)+"')
   end

   returned.should == "ok"
# Doing positive test first

but it doesn't find the alert box when it is displayed, and it is not
working when I am setting the URL outside the block as well.

2)
Option two, however, does work, but only for firefox, and I would want
it to work for all browsers with watir-webdriver.

unless (@browser.driver.switch_to.alert.text.nil?)
 #raise "Javascript popup box is found, malicious code might be able
to insert on page"
end

Option one works when it is invoked from a button, but not when
javascript is invoked from browser url. Can someone please help me?

Best Regards
Matt


On Mar 3, 3:52 pm, Jari Bakken  wrote:
> On Thu, Mar 3, 2011 at 2:12 PM, Usman Hussain  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
>
> Seehttps://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 
> herehttp://code.google.com/p/selenium/source/browse/trunk/rb/spec/integra...
>
> 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: Interact with Javascript Pop Up

2011-03-07 Thread Mattias Karlsson


On Mar 3, 3:52 pm, Jari Bakken  wrote:
> On Thu, Mar 3, 2011 at 2:12 PM, Usman Hussain  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
>
> Seehttps://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 
> herehttp://code.google.com/p/selenium/source/browse/trunk/rb/spec/integra...
>
> 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


Re: [wtr-general] Re: Interact with Javascript Pop Up

2011-03-07 Thread Jari Bakken
On Mon, Mar 7, 2011 at 12:04 PM, Mattias Karlsson
 wrote:
>
> 1)
>  returned = @browser.alert do
>    @browser.goto('http://
> www.url.com/"+void(document.cookie="authorization=true")+alert(document.cookie)+"')
>   end
>
>   returned.should == "ok"
> # Doing positive test first
>
> but it doesn't find the alert box when it is displayed, and it is not
> working when I am setting the URL outside the block as well.
>

That's correct. If you look at the Browser#alert implementation, we
overwrite the window.alert function, and that will be gone when a new
page is loaded. This approach only works when the page doesn't change
inside the block.

> 2)
> Option two, however, does work, but only for firefox, and I would want
> it to work for all browsers with watir-webdriver.
>

You'll have to stick to Firefox for this test until WebDriver
implements the API cross-browser - it's a work in progress. You can
watch the status of this issue to follow its progress:

  http://code.google.com/p/selenium/issues/detail?id=27

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] Donate to Watir project via Flattr

2011-03-07 Thread Željko Filipin
[image: Flattr logo] 

Andreas Tolf Tolfsen  (of
OperaWatirfame)
suggested that we add
Flattr  donations to our web site.

>From their about  page:

Flattr is the worlds first social micro-payment system.

In short, you create an account, add to your account at least 2
euroseach month (about 2.80 usd at
the moment), and select one or more
*things* (official term). Your 2 euros (or more, if you like) will split
among the *things* you have *flattered* (again, official term).

Flattr is used by NoScript , Debian
Package Manager —
dpkg,
W3C Validator ,
phpMyAdmin,
GNU wget …

You will find our Flattr  donation
button just above our Pledgie  donation
button at the sidebar.

At the moment we have 2 *flattrs* (not sure if this is official term). We
have to pay 2 euros each month to keep our account alive, so we hope we will
get at least that much.

I promise we will not spend all of the money on beer. [image: :)]



Original post:

http://watir.com/2011/03/07/donate-to-watir-project-via-flattr/

Ž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


[wtr-general] Re: Contains Text

2011-03-07 Thread Dave McNulla
What does your code look like?

Dave

-- 
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] Watir Day 2011 Speakers Announced

2011-03-07 Thread Alister Scott
The speakers have been announced for Watir Day:
   http://watir.com/2011/03/08/watir-day-2011-speakers-announced/
   http://watir.com/watir-day/speakers/

Cheers,

Alister Scott
Brisbane, Australia
Watir Web Master: http://watir.com
Blog: http://watirmelon.com
LinkedIn: http://www.linkedin.com/in/alisterscott

"There are two ways to get enough: One is to continue to accumulate more and
more. The other is to desire less." *~ G. K. Chesterton*

-- 
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 2011 Speakers Announced

2011-03-07 Thread Tim Koopmans
Looks fine to me Alister.

Cheers,
Tim

@90kts



On Tue, Mar 8, 2011 at 3:56 PM, Alister Scott wrote:

> The speakers have been announced for Watir Day:
>http://watir.com/2011/03/08/watir-day-2011-speakers-announced/
>http://watir.com/watir-day/speakers/
>
> Cheers,
>
> Alister Scott
> Brisbane, Australia
> Watir Web Master: http://watir.com
> Blog: http://watirmelon.com
> LinkedIn: http://www.linkedin.com/in/alisterscott
>
> "There are two ways to get enough: One is to continue to accumulate more
> and more. The other is to desire less." *~ G. K. Chesterton*
>
> --
> 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: Contains Text

2011-03-07 Thread Soori
Dave,

Please find my code below,

browser.goto('www.mywebsite.com/mypage.html')

lStatus = browser.title
puts lStatus.to_s
  if browser.contains_text("My Engineering Services")
puts lStatus.to_s+","+ "Text Available"
  else
   puts lStatus.to_s+","+ "Text Not Available"
  end
/Soori


On Mar 8, 9:06 am, Dave McNulla  wrote:
> What does your code look like?
>
> Dave

-- 
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: Contains Text

2011-03-07 Thread Dave McNulla
It worked for me - I tried it with the exact text and I tried it with the 
second G missing from engineering. I also tried it like this (I jammed the 
whole IF clause into ternary statement):
puts "#{browser.title.to_s}, #{browser.contains_text('My Engineering 
Services')? 'Text Available': 'Text Not Available'}"

Good Luck,

Dave

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