[wtr-general] Re: Contains Text
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 cjq@gmail.com wrote: You may try: ie.text.include?(***) Wesley. For life, the easier, the better. On Mon, Mar 7, 2011 at 1:18 PM, Soori sure...@gmail.com 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
Yes, you are right Chunk, My HTML code looks like this - /html/body/div/div/div[4]/div/fieldset/table[3]/tbody/tr[9]/td class=normalChange counter/tdtd class=normaldiv class=system0/div/td/tr 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 sqa...@gmail.com 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 ashay.n...@gmail.com wrote: 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] Re: Interact with Javascript Pop Up
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 jari.bak...@gmail.com wrote: 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 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
On Mar 3, 3:52 pm, Jari Bakken jari.bak...@gmail.com wrote: 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 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
On Mon, Mar 7, 2011 at 12:04 PM, Mattias Karlsson mattiaskar...@gmail.com 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
[image: Flattr logo] https://flattr.com/thing/141470/Watir Andreas Tolf Tolfsen http://home.e-tjenesten.org/%7Eato/ (of OperaWatirhttp://www.opera.com/developer/tools/operawatir/fame) suggested that we add Flattr http://flattr.com/ donations to our web site. From their about https://flattr.com/about page: Flattr is the worlds first social micro-payment system. In short, you create an account, add to your account at least 2 euroshttp://en.wikipedia.org/wiki/Euroeach 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 https://flattr.com/thing/42724/NoScript, Debian Package Manager — dpkghttps://flattr.com/thing/29919/Debian-Package-Manager-dpkg, W3C Validator https://flattr.com/thing/65556/W3C-Validator, phpMyAdminhttps://flattr.com/thing/56976/phpMyAdmin, GNU wget https://flattr.com/thing/85825/GNU-wget… You will find our Flattr https://flattr.com/thing/141470/Watir donation button just above our Pledgie http://pledgie.com/campaigns/2982 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
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
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
Looks fine to me Alister. Cheers, Tim @90kts On Tue, Mar 8, 2011 at 3:56 PM, Alister Scott alister.sc...@gmail.comwrote: 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
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 mcnu...@gmail.com 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
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