Re: [wtr-general] Error while installing Watir on Windows 7
On Mon, Nov 29, 2010 at 8:00 PM, abhirevo1 abhi.r...@gmail.com wrote: Please have a look at attached file and let me know is it an error? If you take a closer look, you will see that you got those (warning) messages while installing ri and rdoc documentation for nokogiri gem (that watir gem needs). In the future, you can copy/paste the text from command line, there is no need for screen shots. Not to mention that Google is far better at indexing text than screen shots (so your question could help somebody). :) Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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] Opening new browser window from existing one
On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Ž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] click_no_wait not working for Checkbox
Hi, I need to clear the checkbox which gives a pop up with OK and Cancel buttons. Then I have to click on OK button to proceed. I have used the following code to clear the check box: Object.click_no_wait Sleep 40 To click on OK button on the pop up, code used is When /^clicks OK in the pop up box$/i do sleep 5 startClicker(browser, OK, 60) end Have the following method used for startClicker def startClicker(browser, button , waitTime = 9, user_input = nil) # get a handle if one exists hwnd = browser.enabled_popup(waitTime) if (hwnd) # yes there is a popup w = WinClicker.new if (user_input) w.setTextValueForFileNameField(hwnd, #{user_input}) end # I put this in to see the text being input it is not necessary to work sleep 3 # OK or whatever the name on the button is w.clickWindowsButton_hwnd(hwnd, #{button}) # # this is just cleanup w = nil end end Ruby Version: 1.8.6_26 Issue Description: click_no_wait , clears the check box and throws popup when tested through IRB. But the same is not working when i run the automated script. Can anyone provide your inputs here. Thanks much. -- 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: Opening new browser window from existing one
From the original post, it looked like you were trying to attach the new window *before* clicking on the link that would open the window. Try clicking on the link first, then attach to the new window: Browser.link(:href, /users/new).click# = new window opens Browser.attach(:title, '/Users: new/') # = attach to the new window Chandu On Nov 30, 4:08 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Ž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
Re: [wtr-general] Opening new browser window from existing one
Hi, This is my code: require 'rubygems' require 'firewatir' Watir::Browser.default = 'firefox' Browser = Watir::Browser.new Browser.goto(http://localhost:3000/users;) This goes to the application B = Browser.title.each { |d| puts d.to_s } here i am checking if that page(above) contains any title.The ans is true and i am getting Users: a = Browser.link(:title, Users:).exist? puts a sleep 5 Browser.attach(:title, '/Users:/') On this i get an error i.e. `attach': Unable to locate window, using title and /Users:/ (Watir::Exception::NoMatchingWindowFoundException) Now if i try Browser.attach(:title, Users:) --- No error is displayed and link is not clicked. -- Now the title on clicking the link is Users: which is same which i have mentioned I hope now the confusion is clear :) Please let me know if you require any more info. 2010/11/30 Željko Filipin zeljko.fili...@wa-research.ch On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Ž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.comwatir-general%2bunsubscr...@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: Opening new browser window from existing one
Hi Chandu, I checked the attach code i have written is when the application is opened.And if i try Browser.attach(:title, '/Users: new/') then it gives me error. On Tue, Nov 30, 2010 at 7:00 PM, chandu.tennety chandu.tenn...@gmail.comwrote: From the original post, it looked like you were trying to attach the new window *before* clicking on the link that would open the window. Try clicking on the link first, then attach to the new window: Browser.link(:href, /users/new).click# = new window opens Browser.attach(:title, '/Users: new/') # = attach to the new window Chandu On Nov 30, 4:08 am, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Ž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.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
[wtr-general] Re: Opening new browser window from existing one
You are still trying to attach to the page before it is opened. 1) Do not confuse the The Title TAG which is part of the page header and sets the title of the webpage (which is usually displayed as the title of the browser window) with a 'title' Attribute, which can be set for any number of different tags within a page.. such 'title' attributes apply only to the tag(s) within which they are defined, and with respect to links have ZERO effect on the title of the page that is loaded after the link is clicked. If you click a link and a new page opens, that page will get its title from the title TAG in the page header. Also link's need not have a title attribute defined, so often it's not the best way to identify a link. 2) Attach does not click links, it does ONE thing and one thing only, it attaches a browser object in your code to an active browser window on the system. Period. For that to work the window has to exist, FIRST before you invoke the attach function. 3) The code you provided below NEVER clicks a link, so no new page or browser window is going to get loaded/created. All it does is check for the presence of a link with a specific title attribute, it never clicks that link. 4) Minor detail.. when writing in the Ruby language, most folks reserve names like 'Browser' when defining a class, and use a lowercase variable name 'browser' when creating an instance of the class. I recommend observing that convention as it will make your code less confusing to other folks who are used to seeing things done that way. SO in summary: FIRST click the link, e.g. browser.link(:text. 'New user').click THEN after the clicking of that link has opened a new window, Attach to the window e.g. browser.attach(:title, '/Users: new/') If it takes a bit of time for the new window to open, you might want to put a short sleep between the two commands. (in general, the way to know if that's needed is if it works fine done manually from an IRB session, but fails when running your script.) Try revising the code below to the above into account. If you are still getting an error, provide the specific text of the error in order to assist others in troubleshooting the problem with your code. On Nov 30, 6:45 am, Amit Kulkarni amitkkulkarni...@gmail.com wrote: Hi, This is my code: require 'rubygems' require 'firewatir' Watir::Browser.default = 'firefox' Browser = Watir::Browser.new Browser.goto(http://localhost:3000/users;) This goes to the application B = Browser.title.each { |d| puts d.to_s } here i am checking if that page(above) contains any title.The ans is true and i am getting Users: a = Browser.link(:title, Users:).exist? puts a sleep 5 Browser.attach(:title, '/Users:/') On this i get an error i.e. `attach': Unable to locate window, using title and /Users:/ (Watir::Exception::NoMatchingWindowFoundException) Now if i try Browser.attach(:title, Users:) --- No error is displayed and link is not clicked. -- Now the title on clicking the link is Users: which is same which i have mentioned I hope now the confusion is clear :) Please let me know if you require any more info. 2010/11/30 Željko Filipin zeljko.fili...@wa-research.ch On Tue, Nov 30, 2010 at 7:24 AM, Amit Kulkarni amitkkulkarni...@gmail.com wrote: titleUsers: new/title titleUsers: index/title on the top Browser.attach(:title, '/Users: new/') I am now completely confused what is the title of the page that you want to attach to. One of these could work: Browser.attach(:title = Users: new/) Browser.attach(:title = Users: index/) Browser.attach(:title = /Users: new/) Browser.attach(:title = /Users: index/) Browser.attach(:title = /Users/) More information: http://wiki.openqa.org/display/WTR/New+Browser+Windows Željko -- 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.comwatir-general%2bunsubscr...@googlegroups.com- 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
Re: [wtr-general] Error while installing Watir on Windows 7
Hi, Thanks for reply. I tried test Watir script to check is everything fine and faced this error: *require watir ie.goto(http://www.google.com;) ie =IE.new ie.text_field(:name, q).set pickaxe ie.button(:name, btnG).click* but it gives me error like *rb:2: undefined local variable or method `ie' for main:Object (NameError)* I am unable to get it why this error is coming , never faced this problem when i installed Watir on my XP machine last time. Please help me out if this is some OS dependent issue (also my lapi is 64 bit , is it a problem). Please suggest Thanks Abhirevo On Tue, Nov 30, 2010 at 2:31 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Nov 29, 2010 at 8:00 PM, abhirevo1 abhi.r...@gmail.com wrote: Please have a look at attached file and let me know is it an error? If you take a closer look, you will see that you got those (warning) messages while installing ri and rdoc documentation for nokogiri gem (that watir gem needs). In the future, you can copy/paste the text from command line, there is no need for screen shots. Not to mention that Google is far better at indexing text than screen shots (so your question could help somebody). :) Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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.comwatir-general%2bunsubscr...@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] Error while installing Watir on Windows 7
You're using the ie variable before setting it up, switch these two lines: ie.goto(http://www.google.com;) ie =IE.new ie = IE.new ( or Watir::Browser.new) ie.goto(http://www.google.com;) -c On Tue, Nov 30, 2010 at 11:54 AM, abhirevo1 abhi.r...@gmail.com wrote: Hi, Thanks for reply. I tried test Watir script to check is everything fine and faced this error: require watir ie.goto(http://www.google.com;) ie =IE.new ie.text_field(:name, q).set pickaxe ie.button(:name, btnG).click but it gives me error like rb:2: undefined local variable or method `ie' for main:Object (NameError) I am unable to get it why this error is coming , never faced this problem when i installed Watir on my XP machine last time. Please help me out if this is some OS dependent issue (also my lapi is 64 bit , is it a problem). Please suggest Thanks Abhirevo On Tue, Nov 30, 2010 at 2:31 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Nov 29, 2010 at 8:00 PM, abhirevo1 abhi.r...@gmail.com wrote: Please have a look at attached file and let me know is it an error? If you take a closer look, you will see that you got those (warning) messages while installing ri and rdoc documentation for nokogiri gem (that watir gem needs). In the future, you can copy/paste the text from command line, there is no need for screen shots. Not to mention that Google is far better at indexing text than screen shots (so your question could help somebody). :) Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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: Error while installing Watir on Windows 7
Sorry , mistakenly i could not c this myself.I made the order change regarding instance creation but now i have this error- rb:2: uninitialized constant IE (NameError) for ie =IE.new code line. Still unable to get results .Any idea? Thanks Abhirevo On Dec 1, 12:17 am, Charley Baker charley.ba...@gmail.com wrote: You're using the ie variable before setting it up, switch these two lines: ie.goto(http://www.google.com;) ie =IE.new ie = IE.new ( or Watir::Browser.new) ie.goto(http://www.google.com;) -c On Tue, Nov 30, 2010 at 11:54 AM, abhirevo1 abhi.r...@gmail.com wrote: Hi, Thanks for reply. I tried test Watir script to check is everything fine and faced this error: require watir ie.goto(http://www.google.com;) ie =IE.new ie.text_field(:name, q).set pickaxe ie.button(:name, btnG).click but it gives me error like rb:2: undefined local variable or method `ie' for main:Object (NameError) I am unable to get it why this error is coming , never faced this problem when i installed Watir on my XP machine last time. Please help me out if this is some OS dependent issue (also my lapi is 64 bit , is it a problem). Please suggest Thanks Abhirevo On Tue, Nov 30, 2010 at 2:31 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Nov 29, 2010 at 8:00 PM, abhirevo1 abhi.r...@gmail.com wrote: Please have a look at attached file and let me know is it an error? If you take a closer look, you will see that you got those (warning) messages while installing ri and rdoc documentation for nokogiri gem (that watir gem needs). In the future, you can copy/paste the text from command line, there is no need for screen shots. Not to mention that Google is far better at indexing text than screen shots (so your question could help somebody). :) Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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: Error while installing Watir on Windows 7
As in the parens, with the latest version do Watir::Browser.new Cheers, Charley Baker Lead Developer, Watir, http://watir.com On Tue, Nov 30, 2010 at 12:41 PM, abhibolg123 abhi.r...@gmail.com wrote: Sorry , mistakenly i could not c this myself.I made the order change regarding instance creation but now i have this error- rb:2: uninitialized constant IE (NameError) for ie =IE.new code line. Still unable to get results .Any idea? Thanks Abhirevo On Dec 1, 12:17 am, Charley Baker charley.ba...@gmail.com wrote: You're using the ie variable before setting it up, switch these two lines: ie.goto(http://www.google.com;) ie =IE.new ie = IE.new ( or Watir::Browser.new) ie.goto(http://www.google.com;) -c On Tue, Nov 30, 2010 at 11:54 AM, abhirevo1 abhi.r...@gmail.com wrote: Hi, Thanks for reply. I tried test Watir script to check is everything fine and faced this error: require watir ie.goto(http://www.google.com;) ie =IE.new ie.text_field(:name, q).set pickaxe ie.button(:name, btnG).click but it gives me error like rb:2: undefined local variable or method `ie' for main:Object (NameError) I am unable to get it why this error is coming , never faced this problem when i installed Watir on my XP machine last time. Please help me out if this is some OS dependent issue (also my lapi is 64 bit , is it a problem). Please suggest Thanks Abhirevo On Tue, Nov 30, 2010 at 2:31 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Nov 29, 2010 at 8:00 PM, abhirevo1 abhi.r...@gmail.com wrote: Please have a look at attached file and let me know is it an error? If you take a closer look, you will see that you got those (warning) messages while installing ri and rdoc documentation for nokogiri gem (that watir gem needs). In the future, you can copy/paste the text from command line, there is no need for screen shots. Not to mention that Google is far better at indexing text than screen shots (so your question could help somebody). :) Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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 -- 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: Error while installing Watir on Windows 7
Thanks alot Charley for your so quick replies, it worked successfully. :) -Abhirevo On Dec 1, 12:56 am, Charley Baker charley.ba...@gmail.com wrote: As in the parens, with the latest version do Watir::Browser.new Cheers, Charley Baker Lead Developer, Watir,http://watir.com On Tue, Nov 30, 2010 at 12:41 PM, abhibolg123 abhi.r...@gmail.com wrote: Sorry , mistakenly i could not c this myself.I made the order change regarding instance creation but now i have this error- rb:2: uninitialized constant IE (NameError) for ie =IE.new code line. Still unable to get results .Any idea? Thanks Abhirevo On Dec 1, 12:17 am, Charley Baker charley.ba...@gmail.com wrote: You're using the ie variable before setting it up, switch these two lines: ie.goto(http://www.google.com;) ie =IE.new ie = IE.new ( or Watir::Browser.new) ie.goto(http://www.google.com;) -c On Tue, Nov 30, 2010 at 11:54 AM, abhirevo1 abhi.r...@gmail.com wrote: Hi, Thanks for reply. I tried test Watir script to check is everything fine and faced this error: require watir ie.goto(http://www.google.com;) ie =IE.new ie.text_field(:name, q).set pickaxe ie.button(:name, btnG).click but it gives me error like rb:2: undefined local variable or method `ie' for main:Object (NameError) I am unable to get it why this error is coming , never faced this problem when i installed Watir on my XP machine last time. Please help me out if this is some OS dependent issue (also my lapi is 64 bit , is it a problem). Please suggest Thanks Abhirevo On Tue, Nov 30, 2010 at 2:31 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, Nov 29, 2010 at 8:00 PM, abhirevo1 abhi.r...@gmail.com wrote: Please have a look at attached file and let me know is it an error? If you take a closer look, you will see that you got those (warning) messages while installing ri and rdoc documentation for nokogiri gem (that watir gem needs). In the future, you can copy/paste the text from command line, there is no need for screen shots. Not to mention that Google is far better at indexing text than screen shots (so your question could help somebody). :) Željko -- watir.com - community manager watirpodcast.com - host testingpodcast.com - audio podcasts on software testing. all of them -- 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 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] variablize ff.link(identifier,keyword).exists?
Currently, ff.link(:name,/google/).exists? works and returns true. However, if I variablize things sname = :name skeyword = /google. ff.link(sname,skeyword).exists? returns false. Is there any text that states how to go about this? 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
Re: [wtr-general] variablize ff.link(identifier,keyword).exists?
Symbols and strings aren't interchangeable, but you can convert. name.to_sym = :name :name.to_s = name The first part of the method argument takes a symbol, not a string: sname = name ff.link(sname.to_sym,skeyword).exists? Not tested, but should work. As an aside, hungarian notation in Ruby looks weird and kind of makes no sense. :) Charley Baker Lead Developer, Watir, http://watir.com On Tue, Nov 30, 2010 at 12:41 PM, dave davidrey...@gmail.com wrote: Currently, ff.link(:name,/google/).exists? works and returns true. However, if I variablize things sname = :name skeyword = /google. ff.link(sname,skeyword).exists? returns false. Is there any text that states how to go about this? 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 -- 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] variablize ff.link(identifier,keyword).exists?
You can assign symbol to a variable though: sname = :name The same is true with regular expressions: skeyword = /google/ ff.link(sname, skeyword).exists? I'm not sure if you've modified your code for the example, because links don't typically have name attributes - href would be more common. On 2010-11-30, at 1:17 PM, Charley Baker wrote: Symbols and strings aren't interchangeable, but you can convert. name.to_sym = :name :name.to_s = name The first part of the method argument takes a symbol, not a string: sname = name ff.link(sname.to_sym,skeyword).exists? Not tested, but should work. As an aside, hungarian notation in Ruby looks weird and kind of makes no sense. :) Charley Baker Lead Developer, Watir, http://watir.com On Tue, Nov 30, 2010 at 12:41 PM, dave davidrey...@gmail.com wrote: Currently, ff.link(:name,/google/).exists? works and returns true. However, if I variablize things sname = :name skeyword = /google. ff.link(sname,skeyword).exists? returns false. Is there any text that states how to go about this? 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 -- 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] If-Else and loops
Hi, Please can you let me know how to write IF..ELSE and loops in WATIR with example?? Sudeep -- 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] Opening new browser window from existing one
Hi Amit, does your application code has code to open a new window when you click on the link. e.g. use target attribute of href tag. When you click link manually do you get a new window opened ? why do you want to open a new window from your watir script ? cheers Vishavdeep On Tue, Nov 30, 2010 at 5:13 AM, Amit Kulkarni amitkkulkarni...@gmail.comwrote: Hello all, Can we open a new browser window from the existing one using Firewatir for Linux and for Watir for windows: Following are my gem versions: firewatir (1.6.7, 1.6.5) Following is my code: require 'rubygems' require 'firewatir' Watir::Browser.default = 'firefox' Browser = Watir::Browser.new Browser.goto(http://localhost:3000/users;) sleep 5 *Browser.attach(:title, '/test123/')* #Browser.link(:href, /users/new).click Browser.text_field(:name, user[name]).set(amit) Browser.text_field(:name, user[description]).set(Qa Engineer) Browser.select_list(:name, user[role]).select(Hr) Browser.radio(:id, user_category_hr).set Browser.button(:value, Create).click Browser.link(:href, /users).click The line which is bold is what i am doing for opening the link in new window.Actually this is a link which you can see in the next line which is commented. Now if i click on the link then it opens in the same window.What i want is when i click on the link it should open in new window. I have added the *title property* for the link as well In the Firefox-Edit-Preferences-tab i have unchecked the tab Open new windows in new tab instead But when i run the script it error is displayed as /usr/lib/ruby/gems/1.8/gems/firewatir-1.6.7/lib/firewatir/firefox.rb:272:in `attach': Unable to locate window, using title and /test123/(Watir::Exception::NoMatchingWindowFoundException) from user_create.rb:9 When i inspect the link following code is displayed a title=test123 href=/users/newNew user/a -- 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.comwatir-general%2bunsubscr...@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] If-Else and loops
Google ruby tutorials or Ruby in Twenty Minutes On Wed, Dec 1, 2010 at 7:49 PM, Sudeep sudeeppattn...@gmail.com wrote: Hi, Please can you let me know how to write IF..ELSE and loops in WATIR with example?? Sudeep -- 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