[wtr-general] How do i drag Element to the Page?
Hi, I am facing problem on dragging element to the page. Any help would be appreciated. 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: Unable to click tab in IE/FF
Hi, Below is my portion of html code. I want to click TestSettings tab. div id=testnavigation style=float:left;left:33px ul id=testtablist li id=test_tab_settings class=test-current a title=testSettings onclick=Pages.go('testdisplaySiteSettings', 1); return false; href=# span id=testspanTestSettings/span /a /li /ul /div I tired all 3 below option.But nothing works. ie.link(:id, 'test_tab_settings').click ie.span(:text, 'TestSettings').click ie.div(:id, 'testnavigation').click Below is the error which i get: unable to locate element, using {:tag_na me=span, :text=TestSettingst} (Watir::Exception::UnknownObjectException) Thanks On Oct 14, 9:07 pm, Chuck van der Linden sqa...@gmail.com wrote: If you can't share the HTML with us, and this is a commercial or OS third party tab control, then the next best thing is to point us at the 'examples' or 'demo' page for the control, and indicate specifically which variety you are using. It might be easier to get your answer by moving this question to StackOverflow since that venue allows for proper formatting of code and HTML samples, embedding graphics, and editing both questions and answers after they are posted. On Oct 14, 7:49 am, Tiffany Fodor tcfo...@comcast.net wrote: Hi! I agree with Zeljko, we can't give an informed answer without example html, but here are some 'stabbing in the dark' suggestions to try. You may be able to click on the div, link or span more simply: ie.link(:text, 'span text').click ie.span(:text, 'span text').click ie.div(:id, 'dividname').click Also, we don't know what your problem is. Do you get an error message or does nothing happen? If nothing happens, you may want find out if there's an associated javascript event you need to fire: ie.link(:text, 'span text').click ie.link(:text, 'span text').fireEvent('my_javascript_event') I hope this helps, but if it doesn't, you'll need to provide us with some more specifics. -Tiffany On Oct 14, 5:36 am, ashitha shetty shettyk...@gmail.com wrote: Hi, I am facing problem on clicking tabs. below is my code: ie.link(:id,idname).span(:text,span text).click or ie.div(:id,dividname).span(:text, Span text).click Any help would be appreciated. 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: Selecting a url from an array
Apologies but I think it was me formatting my command incorrectly rather than you suggesting incorrect format. Thanks again for your help. Cheers...Ash On Sep 15, 11:47 pm, orde ohil...@gmail.com wrote: Ash - glad you got it working. Regarding the regular expression, SciTE recognizes this as valid: $links.detect { |$links| /^http:\/\/word/=~ $links } How is the format incorrect? orde --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Selecting a url from an array
Orde, that didn't work I'm afraid. Karim, what would be the correct format? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Selecting a url from an array
Got it to work now after several iterations. .detect is now giving me the url I need. So how do I select this url? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Selecting a url from an array
OK, so I am a plonker. Just needed to store the result of my .detect as a variable then use $browser.goto. Hope I haven't wasted anybody's time. Cheers...Ash On Sep 14, 10:05 am, ash ashbr...@gmail.com wrote: Got it to work now after several iterations. .detect is now giving me the url I need. So how do I select this url? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Selecting a url from an array
I am using the following to collect all the links on a page and now need to select a particular link to click on; $browser.links.each do |l| #Relative link if (l.href.first == /) $url = $browser.url + l.href[1..-1] else $url = l.href end if !$links.include?($url) $links.push $url end end The following finds the very first link but I need to find the first link that contains a certain word; $links.detect { |$links| /^http/ =~ $links } Have tried the line below but it gets confused because of the extra //. $links.detect { |$links| /^http://word/ =~ $links } Is it possible to tell watir/ruby to ignore the extra forward slashes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Checking all links on a web page
Another topic where I have found some part answers but not what I am really looking for. What I need is a way of clicking each link on a page to ensure they don't error. I can't code each link individually as they are changing regularly. So far I have been able to list the links with; $browser.links.each { |l| puts l.to_s } So I am just looking for a loop I suppose, inside which each link can be clicked and checked before hitting back to try the next one. Cheers...Ash --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Checking all links on a web page
Thanks for that Felipe. As far as validation goes I think my only option is to check that pages visited are not error pages; maybe checking for existnce of page cannot be found text. On Jun 5, 2:48 pm, Felipe Knorr Kuhn fkn...@gmail.com wrote: Hello, The code posted by Željko will work only if all your links are absolute. Try this: require rubygems require watir $browser = Watir::Browser.new $browser.goto http://www.google.com; $links = Array.new $browser.links.each do |l| #Relative link if (l.href.first == /) $url = $browser.url + l.href[1..-1] else $url = l.href end if !$links.include?($url) $links.push $url end end $links.each do |l| $browser.goto l #use your validation here... end The code above will create an array of unique links and navigate through them. How are you going to validate the pages? FK --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Checking all links on a web page
Again, thanks Felipe. Looks like the solution I need. I will report back when I have had a chance to script and test. Cheers...Ash On Jun 5, 3:25 pm, Felipe Knorr Kuhn fkn...@gmail.com wrote: Ash, If you don't need to be authenticated in the app, this thread might help you: http://groups.google.com/group/watir-general/browse_thread/thread/264... Checking for the response code of the server is more reliable than looking for some text :) FK 2009/6/5 ash ashbr...@gmail.com Thanks for that Felipe. As far as validation goes I think my only option is to check that pages visited are not error pages; maybe checking for existnce of page cannot be found text. On Jun 5, 2:48 pm, Felipe Knorr Kuhn fkn...@gmail.com wrote: Hello, The code posted by Željko will work only if all your links are absolute. Try this: require rubygems require watir $browser = Watir::Browser.new $browser.goto http://www.google.com; $links = Array.new $browser.links.each do |l| #Relative link if (l.href.first == /) $url = $browser.url + l.href[1..-1] else $url = l.href end if !$links.include?($url) $links.push $url end end $links.each do |l| $browser.goto l #use your validation here... end The code above will create an array of unique links and navigate through them. How are you going to validate the pages? FK- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] How to click on text/images/links within a vidPane
I have been struggling with a section of my script for some time now where I generate what appears to be a pop up with 2 options for moving on. Having unsuccessfully tried many different pop up handling methods I am now a little stuck. Looking at the html the 'pop up' is referred to as a vidPane. Does this ring any bells with any one? #--Code to generate the pop up--# require 'watir' require 'watir/ie' Watir::Browser.default = 'ie' $browser = Watir::Browser.new $homepage = https://www.figleaves.com/uk/home.asp; $browser.goto $homepage puts Step 1: enter 'FE-5126' in the search text field $browser.text_field(:name, query).set FE-5126 puts Step 2: click the 'Go' button $browser.button(:name, go).click puts Step 3: select '36D' from size drop down $browser.select_list(:name, selSizes).set(36D) puts Step 4: select '1' from $browser.select_list(:name, selQty0).set(1) $browser.button(:class, button_buynow).click #--end of code--# html of 'pop up'; div id=vidPane style=position: absolute; z-index: 2000; top: 280px; left: 240px; width: 398px; height: 134px; background-color: rgb (123, 117, 121); div style=position: absolute; z-index: 2000; left: 377px; top: 6px; input type=image onclick=cShop() src=http://images.figleaves.com/ uk/images/eng-gbr/navigation/basket_confirmation/15497_close.gif/ /div div style=position: absolute; z-index: 2000; left: 30px; top: 14px; img height=35 width=337 src=http://images.figleaves.com/uk/ images/eng-gbr/navigation/basket_confirmation/15497_title.gif alt=/ /div div style=position: absolute; z-index: 2000; left: 114px; top: 62px; input type=image src=http://images.figleaves.com/uk/images/eng-gbr/ navigation/basket_confirmation/15497_button2.gif onclick=cShop()/ /div a style=text-decoration: none; onclick=cCart() href=# div style=position: absolute; z-index: 2000; left: 123px; top: 111px; color: rgb(242, 242, 227); font-family: Verdana; font-size: 10px; font-weight: bold; OR VIEW YOUR BASKET img height=10 width=10 src=http://images.figleaves.com/uk/images/ eng-gbr/navigation/basket_confirmation/15497_arrow.gif style=position: absolute; top: 1px; alt=/ /div /a /div --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: How to work with popups?
There are now a number of threads regarding pop ups including those referring to javascript alerts. I have successfully scripted checks for the 'OK' button on an alert but am now struggling with an alert that has different options and would gratefully receive any advice out there. On May 15, 8:36 am, suri sureshreddy@gmail.com wrote: Better to use click_no_wait instead only click --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Logging to file with Firefox
Any one tried producing their own FireWatir logger? FireWatir doesn't support logging like Watir does. You need to write your own logger for that. You can add a JIRA ticket for this. - Angrez --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Logging to file with Firefox
Full script with line numbers (followed by the full error); 1 #-# 2 require 'watir' 3 require 'test/unit' 4 require 'example_logger1' 5 6 class TC_go_to_homepage Test::Unit::TestCase 7 8 def start 9 Watir::Browser.default = 'firefox' 10 $browser = Watir::Browser.new 11 # $browser.speed = :fast 12 $homepage = http://www.figleaves.com; 13 filePrefix = create_account_log 14 $logger = LoggerFactory.start_xml_logger(filePrefix) 15 $browser.set_logger($logger) 16 end 17 18 def test_a 19start 20$logger.log(Beginning of test: Figleaves - Go to Homepage) 21$logger.log( Step 1: go to Figleaves.com) 22$browser.goto $homepage 23 if $browser.url == http://www.figleaves.com/uk/home.asp; 24$logger.log( Result: Passed) 25 else 26$logger.log( Result: Failed) 27 end 28 end 29 30 end 31 #---# Output; ruby test_firefox_logging.rb Loaded suite test_firefox_logging Started log Starting XMLLogger... E Finished in 4.656 seconds. 1) Error: test_a(TC_go_to_homepage): NoMethodError: undefined method `set_logger' for #FireWatir::Firefox: 0x3383cb0 test_firefox_logging.rb:15:in `start' test_firefox_logging.rb:19:in `test_a' 1 tests, 0 assertions, 0 failures, 1 errors Exit code: 1 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Logging to file with Firefox
Having successfully scripted tests in ie and firefox I tried to add logging. Got it working well in ie but when I try the same with firefox I get the following error; undefined method `set_logger' for #FireWatir::Firefox:0x3383cc4 This is a sample of my script which produces the error; #-# require 'watir' require 'test/unit' require 'example_logger1' class TC_go_to_homepage Test::Unit::TestCase def start Watir::Browser.default = 'firefox' $browser = Watir::Browser.new # $browser.speed = :fast $homepage = http://www.figleaves.com; filePrefix = create_account_log $logger = LoggerFactory.start_xml_logger(filePrefix) $browser.set_logger($logger) end def test_a start $logger.log(Beginning of test: Figleaves - Go to Homepage) $logger.log( Step 1: go to Figleaves.com) $browser.goto $homepage if $browser.url == http://www.figleaves.com/uk/home.asp; $logger.log( Result: Passed) else $logger.log( Result: Failed) end end end #---# I suppose my questions are; 1. Can logging be used with Firefox? 2. If so, what am i missing? Cheers...Ash --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Stripping url
Having searched this group, plus the wiki, plus the mail archives I am still a little confused as to the syntax format for stripping text from a url. Apologies if there is a thread covering this already but I am now getting frustrated with this as it seems such a simple task but I can't get my head round it. I have a check in a test to ensure that the url reached is correct but there is a variable at the end of the url that I don't need. How do I get rid of this? My url is of the format http://www.blah.com/uk/home.asp?variable So far I have discovered that the following will possibly help; new_url = ie.url[/(.*)\//] although this strips everything after uk/. I just need to strip out ?variable. My question is really; What does this mean? [/(.*)\//] Cheers...Ash --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Stripping url
Spot on, thanks. I don't really know Ruby yet but using your advice I got it working. My new code; require 'watir' test_site=http://www.blah.com/uk/home.asp?src=ash; ie = Watir::IE.new ie.speed = :fast ie.goto test_site url=ie.url url_splitted=url.split(?) if url_splitted[0] == http://www.blah.com/uk/home.asp; puts ok else puts bugger! end On May 1, 1:01 pm, karim rayani karim@gmail.com wrote: do one thing if you know ruby somewhat url=ie.url url_splitted=url.split(?) puts url_splitted[0] should give you the base url On Fri, May 1, 2009 at 5:00 PM, ash ashbr...@gmail.com wrote: Having searched this group, plus the wiki, plus the mail archives I am still a little confused as to the syntax format for stripping text from a url. Apologies if there is a thread covering this already but I am now getting frustrated with this as it seems such a simple task but I can't get my head round it. I have a check in a test to ensure that the url reached is correct but there is a variable at the end of the url that I don't need. How do I get rid of this? My url is of the formathttp://www.blah.com/uk/home.asp?variable So far I have discovered that the following will possibly help; new_url = ie.url[/(.*)\//] although this strips everything after uk/. I just need to strip out ?variable. My question is really; What does this mean? [/(.*)\//] Cheers...Ash -- Regards, Alkarim Rayani- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: click_no_wait and click! not working javascript popup
I am also receiving the TimeOutException but am using solution #4 from http://wiki.openqa.org/display/WTR/JavaScript+Pop+Ups so do not have anywhere to place the sleep. Segment of my script; ie.button(:class, button_checkout).click_no_wait hwnd = ie.enabled_popup(5) if (hwnd) #yeah! a popup popup = WinClicker.new popup.makeWindowActive(hwnd) popup.clickWindowsButton(Windows Internet Explorer, OK, 30) end Where should I put the 'sleep'? Obviously I may be missing the point so feel free to shout at me if necessary. Cheers...Ash --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: FireWatir 1.6.2 unittests don't run
I could also use some help with this so if the wiki could be updated that would be great. Went to see where the commonwatir directory should be and discovered that there is already a 'commonwatir-1.6.2' directory here; C:\Ruby\lib \ruby\gems\1.8\gems\commonwatir-1.6.2. Any help would be gratefully appreciated. Cheers...Ash --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---