Re: [wtr-general] need help on how to close the new windows
Watir Code to Close All Browser windows: Option 1. Kill the process of browsers: system(taskkill /t /f /im iexplore.exe) Option 2. require 'watir/close_all' Watir::IE.close_all This can be tweaked for all browser types like Chrome, Firefox, etc On Thursday, December 31, 2009 7:12:40 AM UTC+5:30, Wesley Chen wrote: That's exactly as what Prajakta said, you can try the method provided below. def new_window # get a handle if one exists aa = Win32API.new(user32, GetForegroundWindow,[] , 'L') hwnd = aa.call if (hwnd) # yes there is a popup return Watir::IE.attach(:hwnd, hwnd) else return nil end end $ie = Watir::IE.start(your_url) $ie.link(your_link).click if ie2 = new_window ie2.close end Thanks. Wesley Chen. For life, the easier, the better. On Wed, Dec 30, 2009 at 9:26 PM, Prajakta Jadhav jadhav@gmail.comjavascript: wrote: If in case you are clicking on some link/image which in turn opens a new browser window then u ll need to get the handle of that new window first. Then u can execute browser.close on it. U ll need to attach the new window to a new watir browser instance. eg - ie2 = watir::IE.new ie2.attach(:url, url of new browser window) ie2.close On Wed, Dec 30, 2009 at 2:43 PM, Tester joen...@gmail.com javascript:wrote: i am running a watir script on a url. The script opens pdf documents in new windows. There are more that 100 pdf files on opening each in new window the window hangs and I am not able to run the entire script. Can some one help me out in this. Is there a method such as ie.close to close the new browser window getting opened from the main window in watir? -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-...@googlegroups.comjavascript: Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-genera...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/watir-general -- You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-...@googlegroups.comjavascript: Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-genera...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/watir-general -- 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] need help on how to close the new windows
i am running a watir script on a url. The script opens pdf documents in new windows. There are more that 100 pdf files on opening each in new window the window hangs and I am not able to run the entire script. Can some one help me out in this. Is there a method such as ie.close to close the new browser window getting opened from the main window in watir? -- 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
Re: [wtr-general] need help on how to close the new windows
On Wed, Dec 30, 2009 at 10:13 AM, Tester joeni...@gmail.com wrote: Is there a method such as ie.close Yes. browser.close should close the browser. Quick overview of Watir methods: http://wiki.openqa.org/display/WTR/Cheat+Sheet Željko -- watir.com - community manager watirpodcast.com - host -- 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
Re: [wtr-general] need help on how to close the new windows
u will need to get the handle of new browsers that are opening then execute browser.close for those browser windows if you are clicking some link/image which in turn opens your new browser window then you will have to use some 'getwindow' type of method to get the handle of that browser -Prajakta On Wed, Dec 30, 2009 at 2:43 PM, Tester joeni...@gmail.com wrote: i am running a watir script on a url. The script opens pdf documents in new windows. There are more that 100 pdf files on opening each in new window the window hangs and I am not able to run the entire script. Can some one help me out in this. Is there a method such as ie.close to close the new browser window getting opened from the main window in watir? -- 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 -- 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
Re: [wtr-general] need help on how to close the new windows
If in case you are clicking on some link/image which in turn opens a new browser window then u ll need to get the handle of that new window first. Then u can execute browser.close on it. U ll need to attach the new window to a new watir browser instance. eg - ie2 = watir::IE.new ie2.attach(:url, url of new browser window) ie2.close On Wed, Dec 30, 2009 at 2:43 PM, Tester joeni...@gmail.com wrote: i am running a watir script on a url. The script opens pdf documents in new windows. There are more that 100 pdf files on opening each in new window the window hangs and I am not able to run the entire script. Can some one help me out in this. Is there a method such as ie.close to close the new browser window getting opened from the main window in watir? -- 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 -- 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