[wtr-general] Issue with .options method with select_list
Hi, Im using Ruby 1.8.6 with Watir 1.6.2 i know its is very old but we have maintained this structure becasue of some reasons. Presently i m getting NOMETHODERROR when i use .options with select_list. Here is my code : elems = Array.new values = Array.new elems = $ie.select_list(:id,"setTagList").options puts elems 0.upto(elems.length - 1) do |i| values.push elems[i].text end It shows errros as : NoMethodError: undefined method `options' for # I also tried this : searchList = $ie.select_list(:id,"setTagList") selectContent = searchList.options.collect { |option| option.value } Still same error. But .options is supported for select_list, then why im getting this error? Can anyone help? Thanks Bhavesh -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Issue using .options with select_list
Hi, im getting error as NoMethodError for .option which im using with select_list. i have Ruby 1.8.6 and watir 1.6.2. definitely it is old version but right now i cannot upgrade it due to some limitation for my project. Now i wrote code like this : elems = Array.new values = Array.new elems = $ie.select_list(:id,"setTagList").options puts elems 0.upto(elems.length - 1) do |i| values.push elems[i].text end 0.upto(values.length - 1) do |i| puts values[i] if values[i] =~ /DupTags/ returnValue = false else returnValue = true end end But then it shows error that undefined method .options like this : NoMethodError: undefined method `options' for # I also tried like this, but same error : searchList = $ie.select_list(:id,"setTagList") selectContent = searchList.options.collect { |option| option.value } So what is the issue here? .option is bydefault method i guess. then why its not working. please help. bhavesh -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Re: Need info about how to get browser version in watir classic and about ie8 and ie9 support.
Hi Jarmo, I tried using what you said but it throws error. if i use Watir::IE.version, then it throws error for unknown constant version. And if i use Watir::IE::Version then it shows watir version insetad of IE version. And if i use Watir::Browser.version or Watir::Browser::Version the also some error like uninitialized constant Watir::Browser::VERSION etc. So what is the right method to get browser version? Please suggest thanks bhavesh On Friday, April 11, 2014 12:36:39 PM UTC+5:30, Bhavesh wrote: > > Thanks Jarmo. > > Thanks everyone for your comments, by the way we have another UI where we > are using watir webdriver. But this is very old ui with no work done and it > is left as it is with old version of automation framework. > > thanks > bhavesh > > On Friday, April 11, 2014 2:44:39 AM UTC+5:30, Jarmo Pertman wrote: >> >> You can also use Watir::IE.version or Watir::Browser.version depending of >> the version of watir/watir-classic used. >> >> Jarmo Pertman >> - >> IT does really matter - http://itreallymatters.net >> >> >> On Thursday, April 10, 2014 4:51:00 PM UTC+3, Oscar.Rieken wrote: >>> >>> and on a second note I would probably update to more recent versions of >>> ruby/watir imo >>> >>> >>> On Thu, Apr 10, 2014 at 9:50 AM, Oscar Rieken wrote: >>> >>>> I personally would just drop down to webdriver and ask it what its caps >>>> are >>>> >>>> [1] pry(main)> require 'watir-webdriver' >>>> => true >>>> [2] pry(main)> b = Watir::Browser.new :chrome >>>> => # >>>> [3] pry(main)> b.driver.capabilities >>>> => #>>> @capabilities= >>>> {:browser_name=>"chrome", >>>>:version=>"33.0.1750.152", >>>>:platform=>:"mac os x", >>>>:javascript_enabled=>true, >>>>:css_selectors_enabled=>true, >>>>:takes_screenshot=>true, >>>>:native_events=>true, >>>>:rotatable=>false, >>>>:firefox_profile=>nil, >>>>:proxy=>nil, >>>>"acceptSslCerts"=>true, >>>>"applicationCacheEnabled"=>false, >>>>"browserConnectionEnabled"=>false, >>>>"chrome"=> >>>> {"userDataDir"=> >>>> >>>> "/var/folders/_q/cgwwbx596v995n55n32kd1cmgn/T/.org.chromium.Chromium.rKUMb4"}, >>>>"databaseEnabled"=>false, >>>>"handlesAlerts"=>true, >>>>"locationContextEnabled"=>true, >>>>"takesHeapSnapshot"=>true, >>>>"webStorageEnabled"=>true}> >>>> >>>> >>>> On Thu, Apr 10, 2014 at 9:35 AM, Super Kevy < >>>> kpe...@scholarshipamerica.org> wrote: >>>> >>>>> First your running some ancient Ruby and Watir. Consider moving >>>>> forward. >>>>> >>>>> see reference: https://raveendran.wordpress.com/tag/execute_script/ >>>>> >>>>> >>>>> Code for Watir WebDriver IE Browser : >>>>> >>>>> require 'rubygems' >>>>> require 'watir-webdriver' >>>>> br=Watir::Browser.new :ie >>>>> ie=br.execute_script("return navigator.userAgent;") >>>>> puts ie.split("MSIE ")[1].split(";")[0] >>>>> >>>>> >>>>> >>>>> On Wednesday, April 9, 2014 11:39:40 PM UTC-5, Bhavesh wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> >>>>>> >>>>>> I have Ruby 1.8.7 with watir 1.6.5. >>>>>> >>>>>> >>>>>> >>>>>> I need following info: >>>>>> >>>>>> >>>>>> >>>>>> 1. How do I get browser version I mean IE version script is >>>>>> running i.e ie7 or ie8 or ie9 etc. >>>>>> >>>>>> >>>>>> >>>>>> 2. I have Ruby 1.8.7 with watir 1.6.5, where I have lot of TC >>>>>> automated. I need to run these testcases in Ie8 and IE9, I know I have >>>>>> tweak my script to run in these browser but does watir 1.6.5 supports >>>>>> ie8 >>>>>> and ie9? I mean it is not like I get errors when I try to run script? >>>>>> >>>>>> Can someone please help me out with this. >>>>>> >>>>>> >>>>>> >>>>>> Thanks >>>>>> >>>>>> Bhavesh >>>>>> >>>>> -- >>>>> -- >>>>> Before posting, please read http://watir.com/support. In short: >>>>> search before you ask, be nice. >>>>> >>>>> watir-...@googlegroups.com >>>>> http://groups.google.com/group/watir-general >>>>> watir-genera...@googlegroups.com >>>>> >>>>> --- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Watir General" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to watir-genera...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> >>> -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [wtr-general] Re: Need info about how to get browser version in watir classic and about ie8 and ie9 support.
Thanks Jarmo. Thanks everyone for your comments, by the way we have another UI where we are using watir webdriver. But this is very old ui with no work done and it is left as it is with old version of automation framework. thanks bhavesh On Friday, April 11, 2014 2:44:39 AM UTC+5:30, Jarmo Pertman wrote: > > You can also use Watir::IE.version or Watir::Browser.version depending of > the version of watir/watir-classic used. > > Jarmo Pertman > - > IT does really matter - http://itreallymatters.net > > > On Thursday, April 10, 2014 4:51:00 PM UTC+3, Oscar.Rieken wrote: >> >> and on a second note I would probably update to more recent versions of >> ruby/watir imo >> >> >> On Thu, Apr 10, 2014 at 9:50 AM, Oscar Rieken wrote: >> >>> I personally would just drop down to webdriver and ask it what its caps >>> are >>> >>> [1] pry(main)> require 'watir-webdriver' >>> => true >>> [2] pry(main)> b = Watir::Browser.new :chrome >>> => # >>> [3] pry(main)> b.driver.capabilities >>> => #>> @capabilities= >>> {:browser_name=>"chrome", >>>:version=>"33.0.1750.152", >>>:platform=>:"mac os x", >>>:javascript_enabled=>true, >>>:css_selectors_enabled=>true, >>>:takes_screenshot=>true, >>>:native_events=>true, >>>:rotatable=>false, >>>:firefox_profile=>nil, >>>:proxy=>nil, >>>"acceptSslCerts"=>true, >>>"applicationCacheEnabled"=>false, >>>"browserConnectionEnabled"=>false, >>>"chrome"=> >>> {"userDataDir"=> >>> >>> "/var/folders/_q/cgwwbx596v995n55n32kd1cmgn/T/.org.chromium.Chromium.rKUMb4"}, >>>"databaseEnabled"=>false, >>>"handlesAlerts"=>true, >>>"locationContextEnabled"=>true, >>>"takesHeapSnapshot"=>true, >>>"webStorageEnabled"=>true}> >>> >>> >>> On Thu, Apr 10, 2014 at 9:35 AM, Super Kevy < >>> kpe...@scholarshipamerica.org> wrote: >>> >>>> First your running some ancient Ruby and Watir. Consider moving >>>> forward. >>>> >>>> see reference: https://raveendran.wordpress.com/tag/execute_script/ >>>> >>>> >>>> Code for Watir WebDriver IE Browser : >>>> >>>> require 'rubygems' >>>> require 'watir-webdriver' >>>> br=Watir::Browser.new :ie >>>> ie=br.execute_script("return navigator.userAgent;") >>>> puts ie.split("MSIE ")[1].split(";")[0] >>>> >>>> >>>> >>>> On Wednesday, April 9, 2014 11:39:40 PM UTC-5, Bhavesh wrote: >>>>> >>>>> Hi, >>>>> >>>>> >>>>> >>>>> I have Ruby 1.8.7 with watir 1.6.5. >>>>> >>>>> >>>>> >>>>> I need following info: >>>>> >>>>> >>>>> >>>>> 1. How do I get browser version I mean IE version script is >>>>> running i.e ie7 or ie8 or ie9 etc. >>>>> >>>>> >>>>> >>>>> 2. I have Ruby 1.8.7 with watir 1.6.5, where I have lot of TC >>>>> automated. I need to run these testcases in Ie8 and IE9, I know I have >>>>> tweak my script to run in these browser but does watir 1.6.5 supports ie8 >>>>> and ie9? I mean it is not like I get errors when I try to run script? >>>>> >>>>> Can someone please help me out with this. >>>>> >>>>> >>>>> >>>>> Thanks >>>>> >>>>> Bhavesh >>>>> >>>> -- >>>> -- >>>> Before posting, please read http://watir.com/support. In short: search >>>> before you ask, be nice. >>>> >>>> watir-...@googlegroups.com >>>> http://groups.google.com/group/watir-general >>>> watir-genera...@googlegroups.com >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "Watir General" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to watir-genera...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >> -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] Need info about how to get browser version in watir classic and about ie8 and ie9 support.
Hi, I have Ruby 1.8.7 with watir 1.6.5. I need following info: 1. How do I get browser version I mean IE version script is running i.e ie7 or ie8 or ie9 etc. 2. I have Ruby 1.8.7 with watir 1.6.5, where I have lot of TC automated. I need to run these testcases in Ie8 and IE9, I know I have tweak my script to run in these browser but does watir 1.6.5 supports ie8 and ie9? I mean it is not like I get errors when I try to run script? Can someone please help me out with this. Thanks Bhavesh -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[wtr-general] getting fixnum error for :index in webdriver
Hi I just upgraded to watir webdriver. Using ruby 193. Im using this expression to click on third refresh button in my page : $ie.span(:class => "x-btn-icon refresh", :index => "3").click But then it shows me error as : "failed expected Fixnum, got "3":String" this use to work with my earlier version of watir 1.6.2 and ruby 1.8.7. So what changes i need to do so that this command work and clicks on third refresh button. Any help is apreciated. Thanks bhavesh -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[wtr-general] Help for mysql connect and security warning in internet explorer ie8.
Hi, I have ruby 193 installed and have following gems on my machine : *** LOCAL GEMS *** archive-tar-minitar (0.5.2) bigdecimal (1.1.0) childprocess (0.3.9) columnize (0.3.6) commonwatir (4.0.0) dbd-mysql (0.4.4) dbi (0.4.5) deprecated (2.0.1) ffi (1.9.3 x86-mingw32) io-console (0.3) json (1.5.5) linecache19 (0.5.12) mini_magick (3.5.0) mini_portile (0.5.2) minitest (2.5.1) multi_json (1.8.2) mysql (2.9.1 x86-mingw32) needle (1.3.0) net-sftp (2.1.2) net-ssh (2.7.0) nokogiri (1.6.0 x86-mingw32) rake (0.9.2.2) rautomation (0.13.0) rbx-require-relative (0.0.9) rdoc (3.9.5) ruby_core_source (0.1.5) rubygems-update (2.1.11) rubyzip (1.0.0) selenium-webdriver (2.37.0) subexec (0.2.3) watir (5.0.0 x86-mingw32) watir-classic (4.0.1) watir-webdriver (0.6.4) websocket (1.0.7) win32-api (1.5.0 universal-mingw32) win32-process (0.7.4) win32screenshot (1.0.10) windows-api (0.4.2) windows-pr (1.2.2) I have two issue while using watir webdriver. 1.Im trying to connect to mysql, but it throws me error [I already have libmysql.dll from version 6.0.0] : Here is the my code in file sql.rb : class Kmysql require 'rubygems' require "mysql" #require 'ruby-debug' def connect_db begin @@host = "machine1" @@user = "something" @@password = "something" @@schema = "testplan" @@dbh = Mysql.real_connect(@@host,@@user,@@password,@@schema) rescue Mysql::Error => e puts "Error code: #{e.errno}" puts "Error Message: #{e.error}" puts "Error code: #{e.sqlstate}" if e.respond_to("sqlstate") end end Then I using like this in another file to create a session : require 'Lib/Common/sql' $db = Kmysql.new() $db.connect_db But im getting error as : C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `r equire': cannot load such file -- mysql/mysql_api (LoadError) from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:55:in `require' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x86-mingw32/lib/mys ql.rb:6:in `rescue in ' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x86-mingw32/lib/mys ql.rb:2:in `' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:135:in `require' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:135:in `rescue in require' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_requir e.rb:144:in `require' So what im missing here? Second issue is about security certicate error, I want to bypass that , but it is not possible. Is their any way I can bypass that. I don’t have valid certificate for website now, but I want to complete automation. With watir websriver, as soon as that warning comes, it just freezs and not even able to click on that wrning link “continue to website”. So what is the solution for IE8 which im usng now? Can someone help me with these 2 queries. Thanks Bhavesh -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[wtr-general] page refresh issue in watir script.
Hi, I have script where testcases are defined like this : def test_1012 returnValue = true printTestCaseInfo("SEARCH_0012", "Verify Basic Search Results/two terms(NOT)") returnValue = false if !verifyBasicSearch("java.rmi.RemoteException NOT ABCDEF") newUpdateTestingResult(returnValue, "WEB_SEARCH", "BasicSearch", 1, "SEARCH_0012") end def test_1013 returnValue = true printTestCaseInfo("SEARCH_0013", "Verify Basic Search Internet Style Plus operator") returnValue = false if !verifyBasicSearch("+ throws java.rmi.RemoteException") newUpdateTestingResult(returnValue, "WEB_SEARCH", "BasicSearch", 1, "SEARCH_0013") end However after each testcases, my webpage get refrshed [i see something like F5]. Verifid all methods, there is no where we have refresh for a page. Then why is it like this? Is it like watir itself refresh page after every testcases? Can someone provide me some thoughts for this? Appriciate your help. Thanks Bhavesh -- -- 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 --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to watir-general+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[wtr-general] Re: How to automate sub-menu items using watir.
Im able to click on main menu i.e "View". im using like this to click View menu : $ie.frame(:id, 'MainEx_view_0').frame(:id, 'Classic_workarea_0').frame(:id, 'Form_menubar_0').form(:id, 'MenuBar_0').div(:id, 'MenuBar_view_menu_0html_id').click Problem happens when a submenu is generated when i click "View" main menu. In this submenu, there are other sub options available like Info, register etc, but im not able to click any of it. On Thursday, October 25, 2012 10:15:02 AM UTC-7, RJ wrote: > > what happens when you invoke the following? > > browser.div(:id => "MenuBar_view_menu_0html_id").fire_event('onclick') > > -- 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] How to automate sub-menu items using watir.
I have Menus in my applicaiton like "File", "View" etc. When i try clicking "View", it generates sub menus which inturns have some suboptions. But im not able to click those sub options. Reason is, when i look into those submenu source code, it appears as : # View 1createMenu('MenuBar_view_menu_0','MenuBar_menugroup_0','false','MenuBar_view_menu_0html_id'); 2 3addSubMenu('MenuBar_view_properties_menu_0','MenuBar_view_menu_0','Properties',null); 4 5registerActionControl('__client10_MenuBar_view_info_0','attributes',null,true,false,1,true,'');addMenuItem('__client10_MenuBar_view_info_0','MenuBar_view_properties_menu_0','Info',null,'fireDynamicActionEvent("__client10_MenuBar_view_info_0")',true,true,'P'); 1registerHotKeyHandler('P', 'fireDynamicActionEvent("__client10_MenuBar_view_info_0")', '__client10_MenuBar_view_info_0'); 1 2registerActionControl('__client10_MenuBar_view_mbeanresourceattributes_0','mbeanresourceattributes',null,true,false,1,true,'');addMenuItem('__client10_MenuBar_view_mbeanresourceattributes_0','MenuBar_view_properties_menu_0','Attributes',null,'fireDynamicActionEvent("__client10_MenuBar_view_mbeanresourceattributes_0")',true,true,''); ### So all subme nu is appearing as registerActionControl, which is i think some java script that gets invoked. Do anyone know how to operate using watir on these controls? thanks Bhavesh -- 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 Click on DIV'S having same ID and class.
Thanks Jarmo and Chuck, i will try whatever you provided. I already talked with developer and asked for change. Thanks for your help Bhavesh On May 13, 11:44 am, Chuck van der Linden wrote: > as Jarmo said, the values for id attributes are supposed to be unique, this > is defined in the standards for HTML > > That said, I see no ID attributes present in the HTML samples you provided. > > You can use the index value if you need to, using something along the lines > of > > browser.div(:text => 'Files_Raj', :index => 1).click > > but it's not a good idea unless you don't have a better alternative since > that sort of code can tend to be a bit brittle and break easily if there > are changes to the UI, or the number of elements of that sort are dynamic > and may vary over time. > > The first thing to do is look at things from the perspective of 'how would > I know which one to click if using the site manually', then look at the > larger HTML picture with that in mind. If the thing you want is inside > some other container element that can be easily identified then you can > pick it that way. This ends up being more organic as it were, since you > are interacting along the same lines as the user. > > It looks like you have some custom controls here that create what look like > list boxes (but are not built off the basic html select control). So are > these lists identified somehow? are they nested inside some other div or > some container that also contains an identifier? if so find that item, and > then select the div you need from within that. This (with made-up class > names) might look something like > > browser.div(:class => 'list header', :text => /the select-list > name/).div(:text => 'Files_Raj').click > > I can't show a specific code example without a larger HTML sample that > shows the outer element by which you would know which list you are clicking. > > > > > > > > On Saturday, May 12, 2012 12:16:39 PM UTC-7, Bhavesh wrote: > > > Hi, > > > I have html code for my application where same DIV class and id for an > > particular element is appearing twice. > > > or say in 2 places. > > > Files_Raj > DIV> > > > Files_Raj > DIV> > > > These are appearing twice, and having same class and index. > > > I have to select the last DIV not the first. > > > How can i acheive this. > > > I tried like this : > > > $_ = $ie.html > > $b = $ie.html.scan(/ > viewIndex=\"\S*\">#{subfolders}<\/DIV>/).flatten > > rowid = $b[-1].to_s > > $ie.div(:class => rowid , :index => 5).click > > > But not successfull. it is not clicking the desired element as well as > > not showing any error. > > > Can anyone know? > > > Bhavesh -- 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] How to Click on DIV'S having same ID and class.
Hi, I have html code for my application where same DIV class and id for an particular element is appearing twice. or say in 2 places. Files_Raj Files_Raj These are appearing twice, and having same class and index. I have to select the last DIV not the first. How can i acheive this. I tried like this : $_ = $ie.html $b = $ie.html.scan(/#{subfolders}<\/DIV>/).flatten rowid = $b[-1].to_s $ie.div(:class => rowid , :index => 5).click But not successfull. it is not clicking the desired element as well as not showing any error. Can anyone know? Bhavesh -- 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 specific version installtion.
Hi Right now if i install watir gem, it install 3.0.x there is no .exe file too. So is there a way by which we can install specific version of watir? Can we list how many version are available? Please suggest. Bhavesh -- 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: Handling Java script Popup with Ruby in WATIR
If you have autoit installed, then you can create a small script which look for the window title and the button. As soon as that titles window is there, it will clck the button. Sample may be like : require 'win32ole' begin autoit = WIN32OLE.new('AutoItX3.Control') loop do sleep(30) autoit.ControlClick("Microsoft Office Outlook",'', 'OK') autoit.ControlClick("Security Information",'', '&Yes') autoit.ControlClick("Security Alert",'', '&Yes') sleep(20) end Send("{SPACE}") rescue Exception => e puts e end Have this script runing when you run your script. Bhavesh On Apr 30, 10:13 am, Chuck van der Linden wrote: > consider moving to watir-webdriver perhaps? > > > > > > > > On Sunday, April 29, 2012 10:19:33 PM UTC-7, AQUA wrote: > > > No I have been using, WATIR. And the issue I m facing is; basically I have > > been able to handle the popup using some of the examples available on WATIR > > wiki. But only with click_no_wait. Whenever I use fire_event the the > > javascript is executed but the execution flow stuck until I manually click > > the ok button. Hence the flow never enters the section of the code that is > > used for handling pop-up without manual interference. > > > Thanks & Regards, > > Manav > > > On Friday, April 27, 2012 1:37:34 PM UTC+5:30, Željko Filipin wrote: > > >> On Fri, Apr 27, 2012 at 8:42 AM, AQUA wrote: > >> > I have been working on WATIR for sometimes, but finding issues in > >> handling Java Script pop-ups. > > >> If you are using watir-webdriver, this could help: > > >>http://watirwebdriver.com/javascript-dialogs/ > > >> Željko > >> -- > >> watir.com/book - author -- 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 in Invoking multiple IE's
Hi, I have watir installed. Im starting 1 IE sesion afor my webapplication and soing some stuff. At the same time in paralle, i need to invoke 1 more IE. do some stuff there. Once done close this IE and attach to the previous IE. Will it be possible? Code snippet : # def test $ie = Watir::IE.new() $ie.goto($someLink) $ie1 = Watir::IE.new() $ie1.goto($someaddress) $ie1.close $ie.attach(/previous IE/) $ie.close end ### But this fails, it opens first IE, but then nothing being done. so it is possible to automate such scenarios? Thanks Bhavesh -- 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: Getting Hash value instead of actual link from email.
No..im not using gmail. im using my own corporate emial account. I already posted the query for this on : http://groups.google.com/group/mail-ruby Bhavesh On Apr 25, 10:26 am, Bhavesh wrote: > OK, i will update my query with more details in that forum. > > On Apr 25, 10:17 am, Željko Filipin wrote: > > > > > > > > > On Wed, Apr 25, 2012 at 7:13 PM, Bhavesh wrote: > > > By the way zeljko, im still not able to get the unread emails if i > > > use Mail.all, mail.first or mail.,last. > > > You will have to provide more information. I am monitoring mail gem list so > > feel free to post there. > > > Ž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] using ".parent" to click in UI.
Hi, I have an Table inside which there are entries for folders. I need to select specific folder, but because it is an EXTJS development, all the folders have same div id, spanid, image id etc. Here is the code snippet. # Show AllSOURCEONEARCHIVE https://vm-bhaveshok1/images/c.gif";>https://vm-bhaveshok1/images/ c.gif" unselectable="on">https://vm-bhaveshok1/legal/dashboard.htm#";>ES1 https://vm- bhaveshok1/images/c.gif">https://vm-bhaveshok1/images/c.gif";>https://vm-bhaveshok1/images/c.gif"; unselectable="on">https://vm-bhaveshok1/legal/dashboard.htm#";>bugfix https://vm- bhaveshok1/images/c.gif">https://vm-bhaveshok1/images/c.gif";>https://vm-bhaveshok1/images/c.gif"; unselectable="on">https://vm-bhaveshok1/legal/dashboard.htm#";>f_t So i have to select folder by name "f_T" Only thing that i can use is : $ie.span(:text, "f_t").click. This works fine. Now my requirement is to click on the image that is appearing just before this folder. Since all the folders have same image, it is very difficult to click on the image that is appearing before to this folder f_t. I tried using : $ie.span(:text,"f_t").parent.link(:class, "x-tree-node- anchor").parent.div(:class, "x-tree-node-el x-unselectable x-tree-node- collapsed").image(:class,"x-tree-ec-icon x-tree-elbow-end-plus").click But it fails with error that class x-tree-node-anchor not found. So how can i click on this image which is appearing before the folder f_t. Can some one help me with this? Bhavesh -- 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: Getting Hash value instead of actual link from email.
OK, i will update my query with more details in that forum. On Apr 25, 10:17 am, Željko Filipin wrote: > On Wed, Apr 25, 2012 at 7:13 PM, Bhavesh wrote: > > By the way zeljko, im still not able to get the unread emails if i > > use Mail.all, mail.first or mail.,last. > > You will have to provide more information. I am monitoring mail gem list so > feel free to post there. > > Ž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] Re: Getting Hash value instead of actual link from email.
Thats correct, im struggling on mail when i use mail gem. I already posted an query on : http://groups.google.com/group/mail-ruby but no relies. I posted on ruby forum also, but no replies. Let me try to do it using stackoverflow. By the way zeljko, im still not able to get the unread emails if i use Mail.all, mail.first or mail.,last. Bhavesh On Apr 25, 9:54 am, Chuck van der Linden wrote: > On Tuesday, April 24, 2012 4:31:14 PM UTC-7, Bhavesh wrote: > > > Hi chuck, > > > You are still not getting me. > > > Im am using Watir, and an webapplicaiton. > > > From my application, i can send notification. > > > Once notification is received in Outlook Inbox, i have to get the > > links in that emails. > > > I automated using Watir till i can send the notification on an web > > application. > > > I have written code to get emails also from the Outlook in watir > > script [which i have pasted in last thread]. > > Thanks for providing that detail, if you had started out saying something > to that effect then what you were trying to do would have been a lot > clearer, instead of just presenting us with some code that has nothing to > do with watir and no context to how this relates to work you are doing in > watir. That little bit of background, a single sentence such as "I am > generating an email via automating a web app with watir, but now I need to > validate the content of the resulting mail, especially links within the > mail body" would have greatly helped people to understand the overall > nature of the problem. Then you could go into the fact you are getting a > hash value and not the link and does anyone know how you would get the > link, or iterate the hashes to get the info you need. > > Still, and as Zeljko has explained also, this is really not the forum for > help with automating outlook or pop3 mail access. I now understand you are > using watir to send the mail, but your challenge at this point, how to > receive and verify the mail contents, has little to do with watir unless > you were using something like OWA, Gmail or another web interface to an > email system to handle the mail. > > I would strongly suggest moving this to StackOverflow, and putting some > appropriate tags on the question. You can post a link to it here so anyone > else with a similar problem (or time to assist you) can follow over to it. > You are far more likely to find more folks with experience dealing with > email via ruby, and get some good answers to your question (and the code > can be properly formatted, questions edited and updated as well as > answers). You can also post a link to the question on the google group > that deals with the mail gem. I really think that might be a better way > for you to get this issue resolved. At the very least you are far more > likely to find people with experience doing that kind of coding, than > asking the question here in the Watir group since at this point your > challenge is not really with watir. -- 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: Getting Hash value instead of actual link from email.
Thanks . I will write the code around and get it working. For subfolders, actually inside Inbox, there are sub folder where specific mails are getting collected based on the policy/rules. That is the reason i need to get the mails from subfolder, but let me try it out. thanks bhavesh On Apr 25, 9:15 am, Željko Filipin wrote: > Comments are inline. > > On Wed, Apr 25, 2012 at 5:57 PM, Bhavesh wrote: > > I think you are on vacation Yesterday, otherwise i could have done it > > yesterday. > > Not on vacation, just really busy. :) > > > If i use "mail" gem, then when i try to access new unread email, it > > fails, it always returns first mail whether it is read or unread. > > As far as I remember, when you get mail via POP3 (as you are doing) there > is no way to mark an e-mail message as read. You can just download it and > delete it. You should use IMAP if you want to mark message as read. > > > 1. How can I get all the unread emails ? > > Looks like this should do it: > > Mail.all > > More info: > > http://rubydoc.info/gems/mail/Mail/IMAPhttp://rubydoc.info/gems/mail/Mail/POP3 > > > 2. How can I get all links that are present inside emails? > > I do not think mail gem provides that functionality. > > > or mail message body from the email? > > mail.body.decoded > > More info: > > https://github.com/mikel/mail > > > 3. Can I click Links present inside an email? [This i can do once > > i have an link] > > No, but you can save a link in a variable and than open the page with > Watir. You have to understand that mail gem and watir gem are really > focused. Mail gem just reads, sends and receives mail, does not know > anything about browsers or links. Watir gem just drives browsers, does not > know anything about e-mail. > > > 4. How can I get emails from a specific folder, if I have > > subfolders? > > Do you want to access e-mail messages on a server, or on your local machine? > > Ž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] Re: Getting Hash value instead of actual link from email.
Hi Zeljko, Thanks. You are always helpful. I think you are on vacation Yesterday, otherwise i could have done it yesterday. I tried doing the stuff using "mail" gem, but it didn't worked [Reason is : im not much aware of this gem]. I posted query on ruby mail forum too, but no replies to solve my problem. If i use "mail" gem, then when i try to access new unread email, it fails, it always returns first mail whether it is read or unread. Here is what i posted on mail forum : ## Hi, I added following code in my WATIR script, and abel to get first email from my Inbox require 'mail' require 'openssl' Mail.defaults do retriever_method :pop3, :address=> "email.someemail.com", :port => 995, :user_name => 'domain/username', :password => 'pwd', :enable_ssl => true end puts Mail.first I am new to this forum and have following questions : 1. How can I get all the unread emails ? 2. How can I get all links that are present inside emails? or mail message body from the email? 3. Can I click Links present inside an email? [This i can do once i have an link] 4. How can I get emails from a specific folder, if I have subfolders? If some one can help me, then that will be nice. Thanks in advance. Bhavesh ### The webpage for mail gem states that if you use mail.first, it will return first unread email, so oi did that. When i have not received any input/help here, i thought i can use Autoit, to get it working from outlook. With autoit, still im struggling to mark mail as "read" from "unread" once i get details [mail body] from the mail. And if i use mail gem, then in that case, im totally stuck. If you can help me on "mail" gem, with questions i posted, then it will be very helpfull. Also if you tell me how to mark mail as "read" from "unread" when i use mail gem. thanks Bhavesh On Apr 25, 12:31 am, Željko Filipin wrote: > On Wed, Apr 25, 2012 at 5:13 AM, Bhavesh wrote: > > Only thing if someone can help is, i got the email body but as same > > time i want to mark that email as "read" instead of "unread", so that > > next time when i have another new email, i get content from that new > > email and previous all emails are in read state. > > I guess Chuck is trying to tell you that Watir automates browsers, and you > want to automate Outlook. It does not matter if you are using Watir to send > mail, you have to use another tool to read mail. Are you aware that you are > not using Watir to drive Outlook? (You are using Ruby.) > > I have done a lot of mail sending/reading/parsing and I would highly > suggest that you use another tool (like mail gem) for that, instead of > automating Outlook. If you have questions on how to do that, I would be > glad to help. > > Željko > -- > watir.com/book - author -- 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: Getting Hash value instead of actual link from email.
OK, i got the solution. I pattern matched the link text from the message body. After grabbing the link text, i can use it to navigate. So all ok now. Only thing if someone can help is, i got the email body but as same time i want to mark that email as "read" instead of "unread", so that next time when i have another new email, i get content from that new email and previous all emails are in read state. Does anyone knows it? Bhavesh On Apr 24, 4:31 pm, Bhavesh wrote: > Hi chuck, > > You are still not getting me. > > Im am using Watir, and an webapplicaiton. > > From my application, i can send notification. > > Once notification is received in Outlook Inbox, i have to get the > links in that emails. > > I automated using Watir till i can send the notification on an web > application. > > I have written code to get emails also from the Outlook in watir > script [which i have pasted in last thread]. > > Now im getting some different result which i dont understand as why > hash value is returned instead of actual links. > > Hence i posted the query in Watir forum. > > This thread is now going in some different direction instead of my > problem. > > Since im not using "mail" gem, i cannot post an query to ruby-mail > forum. > > this is simple WATIR script. > > Here is the Snapshot of the full script. > > ## > > # encoding: utf-8 > > $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../..') if $0 == > __FILE__ > > require 'Lib/KazeonCommon/BasicMethodLibrary' > require 'Lib/KazeonCommon/LegalUIMethodLibrary' > require 'Lib/KazeonCommon/WebAutosetup.rb' > > class Mail < Test::Unit::TestCase > > def test_0010 > > $ie.goto($legalLink) > sleep(5) > kazeonLegalLogin("LEGALUI",domain="Local", > loginName="legaladmin") > #kazeonLegalLogin("LEGALUI",domain="Local", > loginName="legaladmin") > sleep(10) > printTestCaseInfo("LEGALUI0007", "create a case with case id, > status 'open', value in Description and value in Responsible > Attorney") > #puts "Select and add reviewers in legal" > # $ie.div(:class => "x-grid3-cell-inner x-grid3-col- > reviewername", :text => "bhavesh").click > # sleep(5) > # $ie.link(:id, "button2").click > # sleep(5) > sleep(5) > puts "Select Active Case" > selectActiveCase("case4") > clickOkButton() > puts "Select Notify Custodian Button" > $_ = $ie.html > $ie.button(:class, "x-btn-text sendemail").click > sleep(5) > puts "Select Add Receipient Button" > $ie.button(:class => "x-btn-text addReviewer", :index => 2).click > sleep(5) > puts "Select Non Ad User Radio Button" > $ie.radio(:value, "nonADUser").click > sleep(5) > puts "Enter Username" > $ie.text_field(:id, "lookupFilter").set("bhavesh.sha...@emc.com") > sleep(5) > puts "Click Go Button" > #$ie.link(:id, "getData").click > sleep(5) > puts "Select User" > $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => > "bhavesh.sha...@emc.com").flash > sleep(2) > $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => > "bhavesh.sha...@emc.com").left_click > sleep(5) > puts "Select Add selected Button" > $ie.button(:value, "Add Selected").click > sleep(3) > puts "Select Close Button" > $ie.button(:value, "Close").click > sleep(5) > puts "Select Send Notification button" > $ie.button(:text, "Send Notifications").click > sleep(10) > puts "Done" > > outlook = WIN32OLE.new('Outlook.Application') > mapi = outlook.GetNameSpace('MAPI') > folders = mapi.Folders > new_messages = 0 > > #Getting email body of unred email > inbox = mapi.GetDefaultFolder(6) > inbox.Items.each do |message| > #puts message.body if message.Unread > puts message.Links if message.Unread > >
[wtr-general] Re: Getting Hash value instead of actual link from email.
Hi chuck, You are still not getting me. Im am using Watir, and an webapplicaiton. >From my application, i can send notification. Once notification is received in Outlook Inbox, i have to get the links in that emails. I automated using Watir till i can send the notification on an web application. I have written code to get emails also from the Outlook in watir script [which i have pasted in last thread]. Now im getting some different result which i dont understand as why hash value is returned instead of actual links. Hence i posted the query in Watir forum. This thread is now going in some different direction instead of my problem. Since im not using "mail" gem, i cannot post an query to ruby-mail forum. this is simple WATIR script. Here is the Snapshot of the full script. ## # encoding: utf-8 $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../..') if $0 == __FILE__ require 'Lib/KazeonCommon/BasicMethodLibrary' require 'Lib/KazeonCommon/LegalUIMethodLibrary' require 'Lib/KazeonCommon/WebAutosetup.rb' class Mail < Test::Unit::TestCase def test_0010 $ie.goto($legalLink) sleep(5) kazeonLegalLogin("LEGALUI",domain="Local", loginName="legaladmin") #kazeonLegalLogin("LEGALUI",domain="Local", loginName="legaladmin") sleep(10) printTestCaseInfo("LEGALUI0007", "create a case with case id, status 'open', value in Description and value in Responsible Attorney") #puts "Select and add reviewers in legal" # $ie.div(:class => "x-grid3-cell-inner x-grid3-col- reviewername", :text => "bhavesh").click # sleep(5) # $ie.link(:id, "button2").click # sleep(5) sleep(5) puts "Select Active Case" selectActiveCase("case4") clickOkButton() puts "Select Notify Custodian Button" $_ = $ie.html $ie.button(:class, "x-btn-text sendemail").click sleep(5) puts "Select Add Receipient Button" $ie.button(:class => "x-btn-text addReviewer", :index => 2).click sleep(5) puts "Select Non Ad User Radio Button" $ie.radio(:value, "nonADUser").click sleep(5) puts "Enter Username" $ie.text_field(:id, "lookupFilter").set("bhavesh.sha...@emc.com") sleep(5) puts "Click Go Button" #$ie.link(:id, "getData").click sleep(5) puts "Select User" $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => "bhavesh.sha...@emc.com").flash sleep(2) $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => "bhavesh.sha...@emc.com").left_click sleep(5) puts "Select Add selected Button" $ie.button(:value, "Add Selected").click sleep(3) puts "Select Close Button" $ie.button(:value, "Close").click sleep(5) puts "Select Send Notification button" $ie.button(:text, "Send Notifications").click sleep(10) puts "Done" outlook = WIN32OLE.new('Outlook.Application') mapi = outlook.GetNameSpace('MAPI') folders = mapi.Folders new_messages = 0 #Getting email body of unred email inbox = mapi.GetDefaultFolder(6) inbox.Items.each do |message| #puts message.body if message.Unread puts message.Links if message.Unread end end end ## Last line im getting unexpected result, for which i posted the query. I dont want to put all code in the post, otherwise it is very big . I hope im clear this time. bhavesh On Apr 24, 4:03 pm, Chuck van der Linden wrote: > There is not a single line of code in what you provided below that is using > Watir. > > Watir is Web Application Testing in Ruby, it is for driving web browsers > and automating web applications. > > "I have outlook open" Outlook is a native application, not a web > application. YOU CANNOT DRIVE OUTLOOK WITH WATIR > There is 'OWA or Outlook Web Access' but I can tell you are not using it > because of this line of ruby code "WIN32OLE.new('Outlook.Application')" > > You need to ask questions of this sort in a more general forum for ruby, or > perhaps on stackoverflow with appropriate tags (such as 'ruby' and 'mapi' ) > > If you were using watir, and a web app
[wtr-general] Re: Getting Hash value instead of actual link from email.
Hi Chuck, I don't expect people to write an code for me. I have already posted the code which i am using in my script in my first Post. Code is : outlook = WIN32OLE.new('Outlook.Application') mapi = outlook.GetNameSpace('MAPI') folders = mapi.Folders new_messages = 0 #Getting email body/Links of unread email inbox = mapi.GetDefaultFolder(6) inbox.Items.each do |message| #puts message.body if message.Unread puts message.Links if message.Unread This is all i am doing. And it is working too I have Outlook opened and it is retriving first unread emial which i want. So i have written an code and it is working. Question is, when i try to retrive email body, it works and retrive it without error. But when i try to retrive links which are in email, it shows Hash values instead of actual links. Here is the output : # . Finished in 0.812500 seconds. So i have a doubt, im not clear and therefore im putting my question. i dont expect anybody to write me a code. I clearly written in my Post that im not using "mail" gem, im doing normal stuf related with emails. I hope that explains my concerns. thanks bhavesh On Apr 24, 2:14 pm, Chuck van der Linden wrote: > Then show us some example HTML and some code that is using watir that shows > what you are trying to do. > > I have for example zero idea what mail system you are even trying to > access, you've given us pretty much zero info other than the code you want > to replace (which itself has very little info we could infer). > > if you are expecting the folks here to write your code for you, that's not > going to happen. we'll provide guidance, advice, and try to get you > unstuck etc. but we're not going to port code from some other gem over to > use watir starting from nothing. Nearly all of us have our hands full > doing our own work, and little time to do someone elses work for free. > > If you have not already done so, spend some time in the watir > tutorialhttp://wiki.openqa.org/display/WTR/Tutorial or with the Watir > Bookhttp://watir.com/book/(which tends to be more current than the wiki > tutorial) to get you started. > > > > > > > > On Tuesday, April 24, 2012 1:49:14 PM UTC-7, Bhavesh wrote: > > > Yes, im doing this in watir. > > > Instead of using mail gem, im using this method to retrive emails. > > > I dont want to install gem "mail". > > > I need to know how to get values instead of these hash values. > > > Bhavesh > > > On Apr 24, 1:36 pm, Chuck van der Linden wrote: > > > The mail gem has it's own google group, the link is in the readme look > > > here: https://github.com/mikel/mail/ > > > > That would be the better place to ask your question > > > > On Tuesday, April 24, 2012 1:32:00 PM UTC-7, Chuck van der Linden wrote: > > > > > I see no watir in your code below, why are you posting this question > > > > here? > > > > > On Tuesday, April 24, 2012 1:28:08 PM UTC-7, Bhavesh wrote: > > > > >> Hi, > > > > >> Im trying to access links inside an email. > > > > >> Im am not using Gem “mail”. > > > > >> Im doing very simple stuff here. > > > > >> Just getting unread email from the mailbox and then getting the links > > > >> present inside that email. > > > > >> When I try to get email bocdy, I get without error. > > > > >> But similarly when I try to get links present inside that email, it > > > >> shows Hash value instead of actual links. > > > > >> Code is : > > > > >> #Getting email body/Links of unread email > > > >> inbox = mapi.GetDefaultFolder(6) > > > >> inbox.Items.each do |message| > > > >> #puts message.body if message.Unread > > > >> puts message.Links if message.Unread > > > > >> What I have to change to get the actual links. > > > > >> Bhavesh -- 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: Getting Hash value instead of actual link from email.
Yes, im doing this in watir. Instead of using mail gem, im using this method to retrive emails. I dont want to install gem "mail". I need to know how to get values instead of these hash values. Bhavesh On Apr 24, 1:36 pm, Chuck van der Linden wrote: > The mail gem has it's own google group, the link is in the readme look > here: https://github.com/mikel/mail/ > > That would be the better place to ask your question > > On Tuesday, April 24, 2012 1:32:00 PM UTC-7, Chuck van der Linden wrote: > > > > > > > > > > > I see no watir in your code below, why are you posting this question > > here? > > > On Tuesday, April 24, 2012 1:28:08 PM UTC-7, Bhavesh wrote: > > >> Hi, > > >> Im trying to access links inside an email. > > >> Im am not using Gem “mail”. > > >> Im doing very simple stuff here. > > >> Just getting unread email from the mailbox and then getting the links > >> present inside that email. > > >> When I try to get email bocdy, I get without error. > > >> But similarly when I try to get links present inside that email, it > >> shows Hash value instead of actual links. > > >> Code is : > > >> #Getting email body/Links of unread email > >> inbox = mapi.GetDefaultFolder(6) > >> inbox.Items.each do |message| > >> #puts message.body if message.Unread > >> puts message.Links if message.Unread > > >> What I have to change to get the actual links. > > >> Bhavesh -- 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] Getting Hash value instead of actual link from email.
Hi, Im trying to access links inside an email. Im am not using Gem “mail”. Im doing very simple stuff here. Just getting unread email from the mailbox and then getting the links present inside that email. When I try to get email bocdy, I get without error. But similarly when I try to get links present inside that email, it shows Hash value instead of actual links. Code is : #Getting email body/Links of unread email inbox = mapi.GetDefaultFolder(6) inbox.Items.each do |message| #puts message.body if message.Unread puts message.Links if message.Unread What I have to change to get the actual links. Bhavesh -- 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: Need information on Accessing outlook and emails for multiple mailboxes
And is it possible to click on link inside an email? On Apr 13, 2:52 pm, Bhavesh wrote: > Hi Zeljko, > > If i use mail gem, can i access emails, links inside it when outlook > is opened and active? > > Reason im asking is i have an outlook, but i dont have an PST path for > it. > > The link which you sent talks about providing the path to email/msg > etc and then accessing that object. > > In my case i dont have PST, or path to object, just i have outlook > opened and all emails are preent insdie a folder Inbox or in some > subfolders. > > Please suggest. > > Bhavesh > > On Apr 13, 12:59 pm, Chuck van der Linden wrote: > > > > > > > > > Do you know about the gmail 'plus' trick? > > > the plus sign an anything after it is just ignored.. > > > So 'testinginbox+vuse...@gmail.com => testingin...@gmail.com > > > but you can tell where it was sent (thus who sent it) > > > Lets you route mail from a lot of sources, each somewhat traceable back to > > its source, all to one inbox > > > On Friday, April 13, 2012 11:12:03 AM UTC-7, Bhavesh wrote: > > > > Thanks for your help Zeljko. > > > > On Apr 13, 9:25 am, Željko Filipin wrote: > > > > On Fri, Apr 13, 2012 at 6:02 PM, Bhavesh > > > wrote: > > > > > We have to verify after email is revieved, what is the body content, > > > > > at what time it is received, we have to click on a link that is > > > > > present inside the email. > > > > > I usually use mail gem for that: > > > > >https://rubygems.org/gems/mail > > > > > Željko > > > > -- > > > > watir.com/book - author -- 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: Need information on Accessing outlook and emails for multiple mailboxes
Hi Zeljko, If i use mail gem, can i access emails, links inside it when outlook is opened and active? Reason im asking is i have an outlook, but i dont have an PST path for it. The link which you sent talks about providing the path to email/msg etc and then accessing that object. In my case i dont have PST, or path to object, just i have outlook opened and all emails are preent insdie a folder Inbox or in some subfolders. Please suggest. Bhavesh On Apr 13, 12:59 pm, Chuck van der Linden wrote: > Do you know about the gmail 'plus' trick? > > the plus sign an anything after it is just ignored.. > > So 'testinginbox+vuse...@gmail.com => testingin...@gmail.com > > but you can tell where it was sent (thus who sent it) > > Lets you route mail from a lot of sources, each somewhat traceable back to > its source, all to one inbox > > > > > > > > On Friday, April 13, 2012 11:12:03 AM UTC-7, Bhavesh wrote: > > > Thanks for your help Zeljko. > > > On Apr 13, 9:25 am, Željko Filipin wrote: > > > On Fri, Apr 13, 2012 at 6:02 PM, Bhavesh > > wrote: > > > > We have to verify after email is revieved, what is the body content, > > > > at what time it is received, we have to click on a link that is > > > > present inside the email. > > > > I usually use mail gem for that: > > > >https://rubygems.org/gems/mail > > > > Željko > > > -- > > > watir.com/book - author -- 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: EXTJS Issue - Problem with watir 1.8.1, but works with watir webdriver.
Any body can help on this? On Apr 12, 12:26 pm, Bhavesh wrote: > Same issue, even if i upgrade the watir gem version to 2.0.4. > > It still fails but works with watir webdriver. > > On Apr 12, 12:24 pm, Bhavesh wrote: > > > > > > > > > Hi, > > > I have a lookup pop-up window. > > > In this windows, everything is under different tables. > > > All the code is in EXTJS, so all are dynamic ids. > > > Code snippet : > > > # > > > > cellPadding=0 border=0> > > > > > > > > > > > > > style="DISPLAY: none; WIDTH: 100px" tabIndex=0> > > > unselectable="on">s...@emc.com > > > tabIndex=0> > > > unselectable="on">s...@emc.com > > > tabIndex=0> > > > unselectable="on">s...@emc.com > > > style="WIDTH: 90px" tabIndex=0> > > > unselectable="on"> > class=x-grid3-focus id=ext-gen971 tabIndex=-1 href="https://vm-shivok1/ > > legal/dashboard.htm#"> > > > > > DIV> > > > > > > > > > onclick=addADToSelectedRecipients(addatagrid); type=button value="Add > > Selected"> > onclick=win_adLookup.close() type=button value=Close> > > > > > DIV> > > > ## > > > I have to click on 1 checkbox, which appears as an checkbox in UI, but > > internally it is something else. > > > If i use simple watir script to click on this checkbox, it fails with > > error that element is not visible. > > > but when i try the same code with watir webdriver, it works. > > > code is : > > > $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => > > "s...@emc.com").click > > > Can someone tell me what changes i shd do , so that this code works > > without webdriver too? > > > thanks > > Bhavesh -- 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: Need information on Accessing outlook and emails for multiple mailboxes
Thanks for your help Zeljko. On Apr 13, 9:25 am, Željko Filipin wrote: > On Fri, Apr 13, 2012 at 6:02 PM, Bhavesh wrote: > > We have to verify after email is revieved, what is the body content, > > at what time it is received, we have to click on a link that is > > present inside the email. > > I usually use mail gem for that: > > https://rubygems.org/gems/mail > > Željko > -- > watir.com/book - author -- 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 information on Accessing outlook and emails for multiple mailboxes
Hi, We need to automate notification functionality for our project. Email are sent from the server to the email user/s. We have to verify after email is revieved, what is the body content, at what time it is received, we have to click on a link that is present inside the email. We have to repeat this with multiple mailboxes. I have created a script to access mailbox, where outlook needs to be opened always and then we can access the mailbox, folders inside it. Can someone let me know, following : 1. Is it possible to access multiple mailboxes? if in my outlook i open mailtiple mailboxes. 2. Is it possible to access various folders, inside multiple mailboxes? 3. How to click Link which is inside the mail ? Do anyone have written any code for it and if anyone can share the code snippet that will be nice? Or may be direct me to some help page where i can found all the detials regarding accessing mailbox/s from WATIR. thanks Bhavesh -- 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: Saving a PDF with Watir
Hi Chuck, Here what ever you are saying make sense, even i have gonbe through the link you proposed. But what in case if you dont have a http address? In my case for download, a additional IE window by title "File Download" gets opened, now i can click on save button on this window.this open another IE window by title "Save As". Now here i have to click on Desktop tab, and then have to save the file. everything in IE. How can i achieve this? Also is there any way by whoch we can unzip OR see the files inside the zip? Bhavesh On Apr 10, 11:16 am, Chuck van der Linden wrote: > So is your job to test that IE can properly save a file, or that the PDF > viewer can properly save a file? How many PDF viewers will you test? > (there are more than just adobe's you know) and what value is testing > someone-elses stuff bringing to your employer? > > Or is your objective to determine if the server has the proper PDF file and > serves it correctly? > > If the objective is the latter, then you might just want to see if you use > Watir to find the URL in the link, then briefly bypass the browser and > download the file. If you can show us a HTML sample we can guide you in how > you would go about determining the link for the PDF file. Once you have > that, you could make a direct HTTP request for the file using standard HTTP > support built into ruby via net/http. > > See this StackOverflow question for examples of code that would directly > download a file using http presuming you know the URL of the file. > http://stackoverflow.com/q/2263540/409820 > > > > > > > > On Tuesday, April 10, 2012 7:50:59 AM UTC-7, Nicolas Turelier wrote: > > > Thanks a lot, but the problem is that all of my tests are only for IE, > > this is a specification I can't sidestep :s > > > Le mardi 10 avril 2012 15:49:38 UTC+2, Željko Filipin a écrit : > > >> On Tue, Apr 10, 2012 at 3:35 PM, Nicolas Turelier < > >> nicolas.turel...@gmail.com> wrote: > >> > The PDF in the popup is opened with the Acrobat Reader interface and I > >> have to save this PDF in a specific folder on my HardDrive. > > >> The easiest thing to do is to disable the PDF reader. This is how to do > >> it in Chrome: > > >> require "watir-webdriver" > >> browser = Watir::Browser.new :chrome > > >> # disable Chrome PDF Viewer > >> browser.goto "about:plugins" > >> browser.span(:text => "Chrome PDF Viewer").parent.parent.parent.a(:text > >> => "Disable", :class => "disable-group-link").click > > >> Then just do what is needed for the popup to appear, and Chrome should > >> download the file to Downloads folder. > > >> Željko > >> -- > >> watir.com/book - author -- 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 information on Accessing outlook and emails for multiple mailboxes
Hi, We need to automate notification functionality for our project. Email are sent from the server to the email user/s. We have to verify after email is revieved, what is the body content, at what time it is received, we have to click on a link that is present inside the email. We have to repeat this with multiple mailboxes. I have created a script to access mailbox, where outlook needs to be opened always and then we can access the mailbox, folders inside it. Can someone let me know, following : 1. Is it possible to access multiple mailboxes? if in my outlook i open mailtiple mailboxes. 2. Is it possible to access various folders, inside multiple mailboxes? 3. How to click Link which is inside the mail ? Do anyone have written any code for it and if anyone can share the code snippet that will be nice? Or may be direct me to some help page where i can found all the detials regarding accessing mailbox/s from WATIR. thanks Bhavesh -- 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: EXTJS Issue - Problem with watir 1.8.1, but works with watir webdriver.
Same issue, even if i upgrade the watir gem version to 2.0.4. It still fails but works with watir webdriver. On Apr 12, 12:24 pm, Bhavesh wrote: > Hi, > > I have a lookup pop-up window. > > In this windows, everything is under different tables. > > All the code is in EXTJS, so all are dynamic ids. > > Code snippet : > > # > > cellPadding=0 border=0> > > > > > > style="DISPLAY: none; WIDTH: 100px" tabIndex=0> > unselectable="on">s...@emc.com > tabIndex=0> > unselectable="on">s...@emc.com > tabIndex=0> > unselectable="on">s...@emc.com > style="WIDTH: 90px" tabIndex=0> > unselectable="on"> class=x-grid3-focus id=ext-gen971 tabIndex=-1 href="https://vm-shivok1/ > legal/dashboard.htm#"> > > DIV> > > > > onclick=addADToSelectedRecipients(addatagrid); type=button value="Add > Selected"> onclick=win_adLookup.close() type=button value=Close> > > DIV> > > ## > > I have to click on 1 checkbox, which appears as an checkbox in UI, but > internally it is something else. > > If i use simple watir script to click on this checkbox, it fails with > error that element is not visible. > > but when i try the same code with watir webdriver, it works. > > code is : > > $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => > "s...@emc.com").click > > Can someone tell me what changes i shd do , so that this code works > without webdriver too? > > thanks > Bhavesh -- 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] EXTJS Issue - Problem with watir 1.8.1, but works with watir webdriver.
Hi, I have a lookup pop-up window. In this windows, everything is under different tables. All the code is in EXTJS, so all are dynamic ids. Code snippet : # s...@emc.com s...@emc.com s...@emc.com https://vm-shivok1/ legal/dashboard.htm#"> ## I have to click on 1 checkbox, which appears as an checkbox in UI, but internally it is something else. If i use simple watir script to click on this checkbox, it fails with error that element is not visible. but when i try the same code with watir webdriver, it works. code is : $ie.div(:class => "x-grid3-cell-inner x-grid3-col-2", :text => "s...@emc.com").click Can someone tell me what changes i shd do , so that this code works without webdriver too? thanks Bhavesh -- 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 table rows columns operations
Hi, How can i operate on cells on the table. I have 1 table, inside that i have many columns and multiple rows like : ID CaseName Status Activities CreationDate Supervisor Actions 1 Deere vs. Michigan StateOpen Completed 2 abc vs. abc State ClosedCompleted Code for this table is as below. I want to operate on various rows value here in this table like if status for a particular case is Open, when i know the caseName. OR if i have to click on various status for a paritular case like for case "Deere vs. Michigan State" i would like to click on Actions or get the value of colum status for this particular case. Can some one help me how to i do this? how can i get the particular values of the column for the said case, when i know the casename ? Thanks Bhavesh 3 http://vm- bhaveshok2.kazeon.local/xgui/#">Deere vs. Michigan State Open http://vm-bhaveshok2.kazeon.local/xgui/ #">http://vm-bhaveshok2.kazeon.local/xgui/ resources/images/status_green.gif" border=0> Alex 11-15-2011 06:09 PM PDT http://vm- bhaveshok2.kazeon.local/xgui/#">12 http://vm- bhaveshok2.kazeon.local/xgui/#">122 - Select - View Case Details Edit Case Details Add Collection Add Notes Manage Activities Manage Reports Manage Custodians Process Export Privilege Log Close Case Delete Case 2 http://vm- bhaveshok2.kazeon.local/xgui/#">abc vs. abc State Open http://vm-bhaveshok2.kazeon.local/xgui/ #">http://vm-bhaveshok2.kazeon.local/xgui/ resources/images/status_green.gif" border=0> Alex 11-16-2011 06:00 PM PDT http://vm- bhaveshok2.kazeon.local/xgui/#">02 http://vm- bhaveshok2.kazeon.local/xgui/#">412 - Select - View Case Details Edit Case Details Add Collection Add Notes Manage Activities Manage Reports Manage Custodians Process Export Privilege Log Close Case Delete Case 4 http://vm- bhaveshok2.kazeon.local/xgui/#">John vs. State Open http://vm-bhaveshok2.kazeon.local/xgui/ #">http://vm-bhaveshok2.kazeon.local/xgui/ resources/images/status_green.gif" border=0> Alex 11-9-2011 04:49 PM PDT http://vm- bhaveshok2.kazeon.local/xgui/#">12 http://vm- bhaveshok2.kazeon.local/xgui/#">78 - Select - View Case Details Edit Case Details Add Collection Add Notes Manage Activities Manage Reports Manage Custodians Process Export Privilege Log Close Case Delete Case -- 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: Not able to select table data inside an table which is having no unique identity.
Yes, i see 3 table by that name grid-btable. irb(main):004:0> browser.tables(:class, "grid-btable").size => 3 I tried below with index as 1, 2 and 3, but evertime it failed : $ie.table(:class => "grid-btable", :index => 1).div(:class, "comboboxpp").td(:text, 'Summary').click failed unable to locate element, using {:text=>"Summary", :tag_name=>"td"} Im not getting how cna i select element from that combo box now? Bhavesh On Jan 18, 2:43 pm, Chuck van der Linden wrote: > For the first three things you listed, I see nothing with 'reportType' > listed in the HTML you posted, so I have no idea what those are trying > to do. > > For the the next three things you list, There's more than one table > row in that table with the class of item which would cause two of > those three to fail because they would be looking in the row wrapped > around the 'Summary' cell and thus unable to find within that row a > cell with text 'Detail' > > However on the face of things, this one here should have worked. > > $ie.table(:class, "grid-btable").div(:class, > "comboboxpp").td(:text, 'Detail').click > > Knowing the exact error given for that one might be useful > > Looking at the entire HTML are you sure that the 'grid-btable' class > is unique? and that within that the class 'comboboxpp' is also > unique? by the looks of the HTML you may have a lot of nested tables > there (I see two implicit and one inferred in the HTML you presented > so it may be that you are having an issue getting the right instance > of one of those. > > an easy way to test for this is to try something like this from an IRB > prompt when you are on the right page > > $ie.tables(:class, "grid-btable").size > > If there is only one, the size will be 1, if there's more than one, > then that could be your problem. > > On Jan 17, 3:42 pm, Bhavesh wrote: > > > > > > > > > Hi, > > > I have table, inside it i have table row, which interm have data > > [text] as Summary and Detail. > > > Source code from IE is : > > > > border=0> > > > > > z.inited="true"> > > > > > style="WIDTH: 115px">Name: > > > > > id=z_f2_vh style="WIDTH: 450px" maxLength=100 > > z.type="zul.widget.Txbox"> > > > > > style="WIDTH: 115px">(Limit 100 characters) > > > z.inited="true"> > > > > > style="WIDTH: 115px">Type: > > > > > id=z_f2_4i z.type="zul.cb.Cmbox" z.combo="true"> > class="comboboxinp readonly" id=z_f2_4i!real readOnly value=Summary > > autocomplete="off"> > src="https://vm-bhaveshok2.kazeon.local/reports/zkau/web/zul/img/ > > combobtn.gif"> > > > > > > > > > > > > > Summary > > > > > > Detail > > > Im looking at last 8 lines. > > > There is no name, class for this table. only there is dynamic id > > generated. > > > I want to select text "Detail: out of this combobox. > > > Can someone help how can i do it. > > > Im using watir webdriver. > > > I tried like : > > > $ie.table(:class, "grid-btable").cell(:class => "item", :text => > > reportType).click > > > $ie.input(:value, "Summary").select(reportType) > > > $ie.input(:value, "Summary").select(reportType) > > > $ie.table(:class, "grid-btable").div(:class, "comboboxpp").tr(:class, > > "item").td(:text, "Detail").click > > > $ie.table(:class, "grid-btable").div(:class, "comboboxpp").td(:text, > > 'Detail').click > > > $ie.div(:class, "comboboxpp").tr(:class, "item").td(:text, > > "Detail").click > > > But all failed with some or other error like not able to find element > > etc. > > > Bhavesh -- 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] Not able to select table data inside an table which is having no unique identity.
Hi, I have table, inside it i have table row, which interm have data [text] as Summary and Detail. Source code from IE is : Name: (Limit 100 characters) Type: https://vm-bhaveshok2.kazeon.local/reports/zkau/web/zul/img/ combobtn.gif"> Summary Detail Im looking at last 8 lines. There is no name, class for this table. only there is dynamic id generated. I want to select text "Detail: out of this combobox. Can someone help how can i do it. Im using watir webdriver. I tried like : $ie.table(:class, "grid-btable").cell(:class => "item", :text => reportType).click $ie.input(:value, "Summary").select(reportType) $ie.input(:value, "Summary").select(reportType) $ie.table(:class, "grid-btable").div(:class, "comboboxpp").tr(:class, "item").td(:text, "Detail").click $ie.table(:class, "grid-btable").div(:class, "comboboxpp").td(:text, 'Detail').click $ie.div(:class, "comboboxpp").tr(:class, "item").td(:text, "Detail").click But all failed with some or other error like not able to find element etc. Bhavesh -- 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] Entering text on a read only textfield.
Hi, Earlier I use Watir unit test frawework and I can enter values in readonly textfield using “.value” method : $ie.text_field(:id, 'targetSSRepsSelected').value=”some value” I upgraded to Watir Webdriver. Now same code fails with error “ReadOnlyException”. Source Code from browser[IE] is : When im using watir earlier, I can enter value on this read only textfield, but with webdriver it fails, so what shd I use to enter values now? Any help is appreciated. Thanks Bhavesh -- 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: Webdriver : when i have to grab the id using pattern match it fails for firefox
Well i got it working with index : $ie.text_field(:class => "inputbg", :index => 0).set "bhavesh" sleep(5) But still im finding ways. Bhavesh On Dec 9, 3:17 pm, Bhavesh wrote: > Hi, > > I got the solution, i written code like this : > > $ie.div(:class => "cell-inner overflow-hidden", :text => > "bhavtest").click > > And it works. > > But there are some cases where only thing we can get is id which is > dynamic like an text filed: > > z.type="zul.widget.Txbox">. > > Here it is only dynmaic id and not even any text. > > I see two problems : > > 1. How can i enter text in this text field when i just have dynamic id > usng webdriver? > > 2. This particular html is present many times in a page, so to get > the ID, which is dynamic, it is very difficult. Here i cannot use > class as it is same in many text fields. If i club index here then it > is alos risky as many text fileds gets added/removed as applicaiton > developed. > > So is there any way i can identify this textbox? > > Right now i pattern match it with few lines above this code, i mean > right now page is like > > "Name: ", > passwrod:" > > So i pattern match with "Name:" then till this textfield. Grabs the > id and then enter text in it, like : > > if /Name:.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.* > \n.*\n.*\n.*\n.*\n.*\n.* > But in webdriver this pattern match is not usable, then i have a > problem, can you suggest any solution to this? > > Bhavesh > On Dec 9, 2:21 pm, Chuck van der Linden wrote: > > > > > > > > > Lets backup a minute because I think you are going about this in a > > very convoluted way based on something you figured out that works, but > > may in fact be a bit of a kludge. > > > The div being clicked on contains a link, an image, and a span with > > text. > > > First question, when interfacing with the site, how does a HUMAN know > > what to click on? Is it the image being displayed? The text? the > > combination of the two? or either? > > > If it's the text, then why not just select the div that way > > > b.div(:text => 'bhavtest').click > > > If it's the Image, then why not find that using a regex for the src > > of the image, and then use .parent to locate the containing div and > > click it? > > > b.img(:src => /your_regex_here/).parent.click > > > if it needs to be a parameter then replace the constants above with a > > variable, or a regex object created from a variable > > > If it's the combination of the two things (image and text) then you > > might have to be a bit trickier but it should still be possible and a > > bit more straightforward than what you were doing. > > > Using ID's to identify something is great where that is something you > > can predict, but otherwise, if you are using some other means to find > > the thing you want, doing that in order to get the ID and then using > > the ID to interact with the element is really just taking the long way > > around. Instead (unless it's not supported) use the thing you know to > > identify and interact with the element. > > > On Dec 9, 11:02 am, Bhavesh wrote: > > > > Ok, > > > > Here is the line that im matching from source from IE : > > > > > > sel href="javascript:;" z.type="Lcfc">https://vm- > > > bhaveshok2.kazeon.local/admin/images/ > > > green_dot.png"align=absMiddle> > > title=bhavtest>bhavtest > > > > My subroutine code is : > > > > def clickFSlink(fsname="") > > > printClickInfo("clickfslink", fsname) > > > $_ = $ie.html > > > if /.*dot.png.*#{fsname}/ > > > printIDInfo("FS ID", $1) > > > begin > > > $ie.div(:id , $1).click > > > rescue => e > > > rescueHandle(e) > > > end > > > sleep($deepSleep) > > > else > > > puts "FAILED! Could not find DatafsID" > > > return false > > > end > > > end > > > > My script is : > > > > require 'watir-webdriver' > > > require 'Lib/KazeonCommon/BasicMethodLibrary' > > > > class test1< Test::Unit::TestCase > > > > def test_ > > > puts > > > "**
[wtr-general] Re: Webdriver : when i have to grab the id using pattern match it fails for firefox
Hi, I got the solution, i written code like this : $ie.div(:class => "cell-inner overflow-hidden", :text => "bhavtest").click And it works. But there are some cases where only thing we can get is id which is dynamic like an text filed: . Here it is only dynmaic id and not even any text. I see two problems : 1. How can i enter text in this text field when i just have dynamic id usng webdriver? 2. This particular html is present many times in a page, so to get the ID, which is dynamic, it is very difficult. Here i cannot use class as it is same in many text fields. If i club index here then it is alos risky as many text fileds gets added/removed as applicaiton developed. So is there any way i can identify this textbox? Right now i pattern match it with few lines above this code, i mean right now page is like "Name: ", passwrod:" So i pattern match with "Name:" then till this textfield. Grabs the id and then enter text in it, like : if /Name:.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.* \n.*\n.*\n.*\n.*\n.*\n.* wrote: > Lets backup a minute because I think you are going about this in a > very convoluted way based on something you figured out that works, but > may in fact be a bit of a kludge. > > The div being clicked on contains a link, an image, and a span with > text. > > First question, when interfacing with the site, how does a HUMAN know > what to click on? Is it the image being displayed? The text? the > combination of the two? or either? > > If it's the text, then why not just select the div that way > > b.div(:text => 'bhavtest').click > > If it's the Image, then why not find that using a regex for the src > of the image, and then use .parent to locate the containing div and > click it? > > b.img(:src => /your_regex_here/).parent.click > > if it needs to be a parameter then replace the constants above with a > variable, or a regex object created from a variable > > If it's the combination of the two things (image and text) then you > might have to be a bit trickier but it should still be possible and a > bit more straightforward than what you were doing. > > Using ID's to identify something is great where that is something you > can predict, but otherwise, if you are using some other means to find > the thing you want, doing that in order to get the ID and then using > the ID to interact with the element is really just taking the long way > around. Instead (unless it's not supported) use the thing you know to > identify and interact with the element. > > On Dec 9, 11:02 am, Bhavesh wrote: > > > > > > > > > Ok, > > > Here is the line that im matching from source from IE : > > > > sel href="javascript:;" z.type="Lcfc">https://vm- > > bhaveshok2.kazeon.local/admin/images/ > > green_dot.png"align=absMiddle> > title=bhavtest>bhavtest > > > My subroutine code is : > > > def clickFSlink(fsname="") > > printClickInfo("clickfslink", fsname) > > $_ = $ie.html > > if /.*dot.png.*#{fsname}/ > > printIDInfo("FS ID", $1) > > begin > > $ie.div(:id , $1).click > > rescue => e > > rescueHandle(e) > > end > > sleep($deepSleep) > > else > > puts "FAILED! Could not find DatafsID" > > return false > > end > > end > > > My script is : > > > require 'watir-webdriver' > > require 'Lib/KazeonCommon/BasicMethodLibrary' > > > class test1< Test::Unit::TestCase > > > def test_ > > puts > > "** > > " > > printTestingReportHeader("I18N Regression Testing", "WEB_ADMIN") > > puts > > "****** > > " > > end > > > def test_0001 > > returnValue = true > > $ie.goto($adminLink) > > sleep(10) > > #skipSecurity("Continue to this website") > > kazeonLegalLogin("WEB_ADMIN", "Local", "admin", "kazeon") > > sleep(5) > > clickFSlink("bhavtest") ## Here it fails for firefox. > > end > > > end > > > This works well in Ie, but when i use the same code by changing > > browser to firefox, it fails. > > > Bhavesh > > > On Dec 9, 10:42 am, Željko Filipin > > wrote: > > > > On Fri, Dec 9, 2011 at 7:06 PM, Bhavesh wrote: > > > > Here im matching "bhavtest" which is actually parameter #{fsname}. > > > > By matching this line, im collecting id div "z_bp_ud!cave" > > > > Then trying to click on that div in UI -- > > > > browser.div(:id , $1).click > > > > I am completely confused. Could you please send only the tag that > > > interests > > > you and your watir code? > > > > Ž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] Re: Webdriver : when i have to grab the id using pattern match it fails for firefox
Ok, Here is the line that im matching from source from IE : https://vm- bhaveshok2.kazeon.local/admin/images/ green_dot.png"align=absMiddle>bhavtest My subroutine code is : def clickFSlink(fsname="") printClickInfo("clickfslink", fsname) $_ = $ie.html if /.*dot.png.*#{fsname}/ printIDInfo("FS ID", $1) begin $ie.div(:id , $1).click rescue => e rescueHandle(e) end sleep($deepSleep) else puts "FAILED! Could not find DatafsID" return false end end My script is : require 'watir-webdriver' require 'Lib/KazeonCommon/BasicMethodLibrary' class test1< Test::Unit::TestCase def test_ puts "**" printTestingReportHeader("I18N Regression Testing", "WEB_ADMIN") puts "**" end def test_0001 returnValue = true $ie.goto($adminLink) sleep(10) #skipSecurity("Continue to this website") kazeonLegalLogin("WEB_ADMIN", "Local", "admin", "kazeon") sleep(5) clickFSlink("bhavtest") ## Here it fails for firefox. end end This works well in Ie, but when i use the same code by changing browser to firefox, it fails. Bhavesh On Dec 9, 10:42 am, Željko Filipin wrote: > On Fri, Dec 9, 2011 at 7:06 PM, Bhavesh wrote: > > Here im matching "bhavtest" which is actually parameter #{fsname}. > > By matching this line, im collecting id div "z_bp_ud!cave" > > Then trying to click on that div in UI -- > > browser.div(:id , $1).click > > I am completely confused. Could you please send only the tag that interests > you and your watir code? > > Ž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] Re: Webdriver : when i have to grab the id using pattern match it fails for firefox
Hi, Here is the source that get generated in IE: https://vm- bhaveshok2.kazeon.local/admin/images/green_dot.png" align=absMiddle>bhavtest https://vm-bhaveshok2.kazeon.local/admin/images/datafs.png"; border=0 z.type="zul.widget.Img"> datafs (nfs) testkaz ntap34 /vol/data/ bhavnfsdata2(tcp,rw) 0 online ## Here im matching "bhavtest" which is actually parameter #{fsname}. By matching this line, im collecting id div "z_bp_ud!cave" Then trying to click on that div in UI -- browser.div(:id , $1).click Now this source is generated differentily in Firefox, so this pattern match failed, and im not able to use it. Im using watir from last 2 years but always as a unit test framework. I switched to Webdriver just now as a requirement and therefore i need my previous code to be align to webdriver so that i can execute my script on all browsers. Can you help me out here? Is there any way i can port all my scripts to webdriver? Bhavesh On Dec 9, 3:48 am, Željko Filipin wrote: > On Fri, Dec 9, 2011 at 12:56 AM, Bhavesh wrote: > > so to collect the id's, i go to source of that page and grab the id > > like : > > $_ = $ie.html > > if /.*dot.png.*#{fsname}/ > > printIDInfo("FS ID", $1) > > Why aren't you using watir api? > > Something like > > browser.divs(how, what).collect {|div| div.id} > > If you provide sample html, we could tell more. > > If it is for speed, there are a few html parsers for ruby: > > https://www.ruby-toolbox.com/categories/html_parsing > > Željko > -- > watir.com/book - author -- 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] Webdriver : when i have to grab the id using pattern match it fails for firefox
Hi, I have to grab id's for some of the fileds by pattern matching, because these are dynamic. so to collect the id's, i go to source of that page and grab the id like : $_ = $ie.html if /.*dot.png.*#{fsname}/ printIDInfo("FS ID", $1) This is what i matched from the source generated when IE is opened. Now im using WEbdriver to drive the watir script. If i use this routine and execute the script on IE, it works well. but if i chnage my driver to firefox, then it fails. It is generous that it will fail, because the source generated in firefox is different then IE, what i pattern matched. So how cna i overcome this problem for webdriver? Such that i can grab the id's using patern match and thne execute the script in IE and firefox both. Or even in Chrome. Can someone help? Bhavesh -- 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] Getting error "incompatible character encodings".
Hi, I have ruby 1.9.2 installed. I have script which is created for utf8 data. I have to use netssh also to send commands having utf8 data to remote computers. For this to work i have to use force encoding to ASCII-8BIT. But after this rest of the places in script have utf8 data but after this netssh command get executed rest of the script failed with for incompatible encoding. # encoding: utf-8 $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '../..') if $0 == __FILE__ require 'Lib/KazeonCommon/BasicMethodLibrary' require 'Lib/KazeonCommon/WebAutosetup.rb' class TC_I18N < Test::Unit::TestCase def setupnew(current_component="") $ie.close if $ie sleep($deepSleep) $ie = Watir::IE.new() sleep($shortSleep) case current_component when "WEB_ADMIN" $ie.goto($adminLink) when "WEB_REPORT" $ie.goto($reportLink) when "WEB_SEARCH" $ie.goto($searchLink) when "LEGALUI" $ie.goto($legalLink) else #puts "setupnew case does not match" end end def test_0001 printTestCaseInfo("I18N_0055", "Add Identity from GUI, for FIGS.") printTestCaseInfo("I18N_0001", "Add AD Authentication from Webadmin, for FIGS.") setupnew("WEB_ADMIN") skipSecurity("Continue to this website") kazeonLegalLogin("WEB_ADMIN", "ES1FR", "âêžýáíúöóá¿", "âêžýáíúöóá¿")#Here script works fine. issueCommandInKazBox5($node1, "add user es1fr+也是夜市 role legaladmin".force_encoding("ASCII-8BIT"), "") clickLogout() end def test_0002 setupnew("WEB_ADMIN") skipSecurity("Continue to this website") kazeonLegalLogin("WEB_ADMIN", "ES1FR", "âêžýáíúöóá¿", "âêžýáíúöóá¿") #same command as above but here i got error clickLogout() end Error appear as : *** TestCaseNum: I18N_0001 Description: Add AD Authentication from Webadmin, for FIGS. > doman - ES1FR > loginName - ├ó├¬┼╛├╜├í├¡├║├╢├│├í┬┐ > loginPasswd - ├ó├¬┼╛├╜├í├¡├║├╢├│├í┬┐ > checkDomainSelectListExist() - Found domain select box waitForShowingUp - Log out - 10 sec FAILED! Page didn't contain text - Cluster Management *** TestCaseNum: I18N_0005 Description: Adding FIGS and CJK users in role admin and legaladmin issueCommandInKazMachine=ui-n14 issueCommandInKazcommand=add user es1fr+Σ╣ƒµÿ»σñ£σ╕é role legaladmin issueCommandInKazstatus= issueCommandInKazuser=admin issueCommandInKazpasswd=kazeon Last login: Sat Aug 20 22:25:51 2011 from gui-xpi18n.kazeon.local Log in as 'admin' to administer the Kazeon ISS system Log in as 'root' for system maintenance only add user es1fr+Σ╣ƒµÿ»σñ£σ╕é role legaladmin exit ui-n14> add user es1fr+Σ╣ƒµÿ»σñ£σ╕é role legaladmin Command failed. Status: Failure Error: User: es1fr+Σ╣ƒµÿ»σñ£σ╕é already exists in Role: legaladmin ui-n14> exit --> clickLogout - . > doman - ES1FR failed incompatible character encodings: ASCII-8BIT and UTF-8 Can someone help me how can i have script working from the point it is failing i.e second login routine. Thanks Bhavesh -- 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: sending i18n data to remote computer using watir scripts.
Di Anyone knows about it? On Jun 29, 3:56 pm, Bhavesh wrote: > Hi, > > I have routines to send commands to remote computer. > > def issueCommandInKazBox5(okMachine="", command="", matchLog="", > user="admin", passwd="kazeon") > puts " issueCommandInKazMachine=#{okMachine}" > puts " issueCommandInKazcommand=#{command}" > puts " issueCommandInKazstatus=#{matchLog}" > puts " issueCommandInKazuser=#{user}" > puts " issueCommandInKazpasswd=#{passwd}" > > Net::SSH.start(okMachine, user, :password => "kazeon", :auth_methods > => ["password"]) do |session| > > session.open_channel do |channel| > > channel.request_pty do |ch, success| > raise "Error requesting pty" unless success > > ch.send_channel_request("shell") do |ch, success| > raise "Error opening shell" unless success > end > end > > channel.on_data do |ch, data| > STDOUT.print data > end > > channel.on_extended_data do |ch, type, data| > STDOUT.print "Error: #{data}\n" > end > > channel.send_data "#{command}\n".force_encoding('utf-8') > channel.send_data "exit\n" > > session.loop > end > end > > end > > I fire commands like this to get the command fire on remote machine : > > issueCommandInKazBox($node1, "add user bhavesh role admin", "") > > It works properly for english data. > > But when i have utf8 data, it throws error : > > issueCommandInKazBox($node1, "add user âêžýáíúöóá¿ role admin", "") > > Error is : > > 1) Error: > test_0001(TC_I18N): > OpenSSL::Cipher::CipherError: data not multiple of block length > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > transport/stat > e.rb:85:in `final' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > transport/stat > e.rb:85:in `final_cipher' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > transport/pack > et_stream.rb:142:in `enqueue_packet' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > transport/sess > ion.rb:223:in `enqueue_message' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:368:in `send_message' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/cha > nnel.rb:493:in `enqueue_pending_output' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/cha > nnel.rb:312:in `process' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:214:in `block in preprocess' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:214:in `each' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:214:in `preprocess' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:197:in `process' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:161:in `block in loop' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:161:in `loop' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:161:in `loop' > C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/Lib/KazeonCommon/ > BasicMethodLibrar > y.rb:2523:in `block (2 levels) in issueCommandInKazBox5' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/cha > nnel.rb:513:in `call' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/cha > nnel.rb:513:in `do_open_confirmation' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:535:in `channel_open_confirmation' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:456:in `dispatch_incoming_packets' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:213:in `preprocess' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:197:in `process' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > connection/ses > sion.rb:161:in `block in loop' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ > c
[wtr-general] sending i18n data to remote computer using watir scripts.
Hi, I have routines to send commands to remote computer. def issueCommandInKazBox5(okMachine="", command="", matchLog="", user="admin", passwd="kazeon") puts "issueCommandInKazMachine=#{okMachine}" puts "issueCommandInKazcommand=#{command}" puts "issueCommandInKazstatus=#{matchLog}" puts "issueCommandInKazuser=#{user}" puts "issueCommandInKazpasswd=#{passwd}" Net::SSH.start(okMachine, user, :password => "kazeon", :auth_methods => ["password"]) do |session| session.open_channel do |channel| channel.request_pty do |ch, success| raise "Error requesting pty" unless success ch.send_channel_request("shell") do |ch, success| raise "Error opening shell" unless success end end channel.on_data do |ch, data| STDOUT.print data end channel.on_extended_data do |ch, type, data| STDOUT.print "Error: #{data}\n" end channel.send_data "#{command}\n".force_encoding('utf-8') channel.send_data "exit\n" session.loop end end end I fire commands like this to get the command fire on remote machine : issueCommandInKazBox($node1, "add user bhavesh role admin", "") It works properly for english data. But when i have utf8 data, it throws error : issueCommandInKazBox($node1, "add user âêžýáíúöóá¿ role admin", "") Error is : 1) Error: test_0001(TC_I18N): OpenSSL::Cipher::CipherError: data not multiple of block length C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ transport/stat e.rb:85:in `final' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ transport/stat e.rb:85:in `final_cipher' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ transport/pack et_stream.rb:142:in `enqueue_packet' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ transport/sess ion.rb:223:in `enqueue_message' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:368:in `send_message' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/cha nnel.rb:493:in `enqueue_pending_output' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/cha nnel.rb:312:in `process' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:214:in `block in preprocess' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:214:in `each' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:214:in `preprocess' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:197:in `process' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:161:in `block in loop' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:161:in `loop' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:161:in `loop' C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/Lib/KazeonCommon/ BasicMethodLibrar y.rb:2523:in `block (2 levels) in issueCommandInKazBox5' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/cha nnel.rb:513:in `call' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/cha nnel.rb:513:in `do_open_confirmation' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:535:in `channel_open_confirmation' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:456:in `dispatch_incoming_packets' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:213:in `preprocess' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:197:in `process' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:161:in `block in loop' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:161:in `loop' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:161:in `loop' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh/ connection/ses sion.rb:110:in `close' C:/Ruby192/lib/ruby/gems/1.9.1/gems/net-ssh-2.1.4/lib/net/ssh.rb: 191:in `sta rt' C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/Lib/KazeonCommon/ BasicMethodLibrar y.rb:2500:in `issueCommandInKazBox5' C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/KazModules/I18N/ I18N_Regression.rb :71:in `test_0001' I already have encoding set to utf8 in my script. what do i have to change to get it working? and where? Bhavesh -- 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: Closing and opening IE session in watir.
Hi, I tried to log a bug but then it default to Bamboo development if i use this link : http://jira.openqa.org/browse/WTR I need to log this to WATIR development, so how can i change the component to watir devlopment. Bhavesh On Jun 8, 12:30 pm, Željko Filipin wrote: > On Wed, Jun 8, 2011 at 7:38 PM, Bhavesh wrote: > > If i replace the piece of code for ie.close of version 1.6.7 in 1.8.1 > > file, the same routine starts working fine. > > I suggest that you create a Jira ticket: > > http://jira.openqa.org/browse/WTR > > Ž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] Re: netssh and ruby 1.9.2
Hi, Im doing automation on Watir. Watir is installed over Ruby. I upgraded Ruby as well as Watir to new version. Now when i execute my watir script, this routine is failing. Bhavesh On Jun 8, 4:03 pm, Charley Baker wrote: > I'll say what other people will. This is a watir user group, you'd likely > find more help on the Ruby forum:http://www.ruby-forum.com/forum/ruby > either that or mailing lists for that project. > > Cheers, > > Charley > > > > > > > > On Wed, Jun 8, 2011 at 4:59 PM, Bhavesh wrote: > > Hi > > > Ealrier i have Ruby 1.8.* and my code to send command to linux box is > > working fine. > > > But now i upgraded to Ruby 1.9.2. So i upgraded needle, setsftp and > > netssh too. > > > Now same piece of code is not working, it throws error for on_success. > > > > > > def issueCommandInKazBox(okMachine="", command="", matchLog="", > > user="admin", passwd="kazeon") > > puts " issueCommandInKazMachine=#{okMachine}" > > puts " issueCommandInKazcommand=#{command}" > > puts " issueCommandInKazstatus=#{matchLog}" > > puts " issueCommandInKazuser=#{user}" > > puts " issueCommandInKazpasswd=#{passwd}" > > > tempString = "" > > Net::SSH.start(okMachine, user, :password => passwd, :paranoid => > > false ) do |session| > > #Net::SSH.start(okMachine, user, passwd) do |session| > > > session.open_channel do |channel| > > > channel.on_success do > > puts "shell was started successfully!" > > > puts "Adding command - #{command}..." > > > channel.send_data "#{command}\n" > > > channel.send_data "exit\n" # tell the shell to exit > > end > > channel.on_failure do > > puts "shell could not be started!" > > end > > > channel.on_data do |ch,data| > > puts "recieved the following from shell" > > puts "#{data}" > > tempString = tempString + "\n" + data > > end > > > channel.on_close do > > puts "shell terminated" > > end > > > channel.send_request "shell", nil, true > > end > > session.loop > > end > > > # > > > Can someone let me know what needs to be change to have this working. > > > Any help is appreciated, im stuck because of this. > > > Bhavesh > > > -- > > 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] netssh and ruby 1.9.2
Hi Ealrier i have Ruby 1.8.* and my code to send command to linux box is working fine. But now i upgraded to Ruby 1.9.2. So i upgraded needle, setsftp and netssh too. Now same piece of code is not working, it throws error for on_success. def issueCommandInKazBox(okMachine="", command="", matchLog="", user="admin", passwd="kazeon") puts "issueCommandInKazMachine=#{okMachine}" puts "issueCommandInKazcommand=#{command}" puts "issueCommandInKazstatus=#{matchLog}" puts "issueCommandInKazuser=#{user}" puts "issueCommandInKazpasswd=#{passwd}" tempString = "" Net::SSH.start(okMachine, user, :password => passwd, :paranoid => false ) do |session| #Net::SSH.start(okMachine, user, passwd) do |session| session.open_channel do |channel| channel.on_success do puts "shell was started successfully!" puts "Adding command - #{command}..." channel.send_data "#{command}\n" channel.send_data "exit\n" # tell the shell to exit end channel.on_failure do puts "shell could not be started!" end channel.on_data do |ch,data| puts "recieved the following from shell" puts "#{data}" tempString = tempString + "\n" + data end channel.on_close do puts "shell terminated" end channel.send_request "shell", nil, true end session.loop end # Can someone let me know what needs to be change to have this working. Any help is appreciated, im stuck because of this. Bhavesh -- 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: Closing and opening IE session in watir.
Hi Željko, I got the problem but not the solution. In watir 1.6.7 which i use previously, code for ie.close is like this : #C:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.7\lib\watir # Closes the Browser def close return unless exists? @closing = true @ie.stop wait rescue nil chwnd = @ie.hwnd.to_i @ie.quit while Win32API.new("user32","IsWindow", 'L', 'L').Call(chwnd) == 1 sleep 0.3 end end In watir 1.8.1 which i use now, code for ie.close is like this : C:\Ruby192\lib\ruby\gems\1.9.1\gems\watir-1.8.1\lib\watir # Closes the Browser def close return unless exists? @ie.stop wait rescue nil chwnd = @ie.hwnd.to_i @ie.quit t = Time.now while exists? # just in case to avoid possible endless loop if failing to close some # window or tab break if Time.now - t > 10 sleep 0.3 end end There is an change in code in 1.8.1. If i replace the piece of code for ie.close of version 1.6.7 in 1.8.1 file, the same routine starts working fine. So what needs to be done now to have this working with 1.8.1 code? Bhavesh On Jun 8, 10:21 am, Bhavesh wrote: > Error coming out as : > > TestCaseNum: I18N_0001 > Description: Add AD Authentication from Webadmin, for FIGS. > > E > Finished in 0.468750 seconds. > > 1) Error: > test_0001(TC_I18N): > NoMethodError: unknown property or method: `name' > HRESULT error code:0x800706ba > The RPC server is unavailable. > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.8.1/lib/watir/ie- > class.rb:319:in > `method_missing' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.8.1/lib/watir/ie- > class.rb:319:in > `exists?' > C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.8.1/lib/watir/ie- > class.rb:406:in > `close' > C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/KazModules/I18N/ > I18N_Regression.rb > :47:in `setupnew' > C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/KazModules/I18N/ > I18N_Regression.rb > :102:in `test_0001' > > On Jun 8, 12:17 am, Željko Filipin > wrote: > > > > > > > > > On Wed, Jun 8, 2011 at 12:51 AM, Bhavesh wrote: > > > It closes the IE if it is open but then not opening the new IE it > > > just came out of script throwing error. > > > And the error message is? > > > Željko > > -- > > watir.com - community manager > > watir.com/book - author > > watirpodcast.com - host > > 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: Closing and opening IE session in watir.
Error coming out as : TestCaseNum: I18N_0001 Description: Add AD Authentication from Webadmin, for FIGS. E Finished in 0.468750 seconds. 1) Error: test_0001(TC_I18N): NoMethodError: unknown property or method: `name' HRESULT error code:0x800706ba The RPC server is unavailable. C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.8.1/lib/watir/ie- class.rb:319:in `method_missing' C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.8.1/lib/watir/ie- class.rb:319:in `exists?' C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-1.8.1/lib/watir/ie- class.rb:406:in `close' C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/KazModules/I18N/ I18N_Regression.rb :47:in `setupnew' C:/IE_AUTOMATION/kazeon/qa/watir-v1_4-TIP/KazModules/I18N/ I18N_Regression.rb :102:in `test_0001' On Jun 8, 12:17 am, Željko Filipin wrote: > On Wed, Jun 8, 2011 at 12:51 AM, Bhavesh wrote: > > It closes the IE if it is open but then not opening the new IE it > > just came out of script throwing error. > > And the error message is? > > Željko > -- > watir.com - community manager > watir.com/book - author > watirpodcast.com - host > 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] not able to send commands to linux boxes when upgraded to Ruby 1.9.2
Hi I have a setup where i have to send command to linux boxes. I installed Ruby 1.9.2 and latest version of needle, net-sftp and net- ssh. routine is like -- def issueCommandInOKBox(okMachine="", command="", expectedLog="", expectedResult="PASS", user="k1", passwd="1") puts "issueCommandInOKBox: okMachine=#{okMachine}" puts "issueCommandInOKBox: command=#{command}" puts "issueCommandInOKBox: expectedLog=#{expectedLog}" puts "issueCommandInOKBox: expectedResult=#{expectedResult}" puts "issueCommandInOKBox: user=#{user}" puts "issueCommandInOKBox: passwd=#{passwd}" returnValue = true Net::SSH.start( okMachine, user, passwd, :paranoid => false) do | session| shell = session.shell.sync puts "Should print home directory:" out = shell.pwd p out.stdout puts "Should print response logs after executing commmand:" out = shell.send_command command p out.stdout $outputofissueCommandInOKBox = out.stdout #puts "--- #{out.stdout}" $_ = out.stdout This is working fine when i have Ruby 1.8 and watir 1.6.5 with needle 1.1.0 and other netssh and netsftp. But now when i upgraded, this fails. I can do ssh using putty to these boxes, but through script it is fialing. Any help how i can have this working? Bhavesh -- 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] Closing and opening IE session in watir.
Hi, I have to close IE and open new IE again in every testcase. I written an routine like this : def setupnew(current_component="") $ie.close if $ie sleep(10) $ie = Watir::IE.new() sleep(10) case current_component when "WEB_ADMIN" $ie.goto($adminLink) when "WEB_REPORT" $ie.goto($reportLink) when "WEB_SEARCH" $ie.goto($searchLink) else #puts "Setup case does not match" end end This works well in Ruby 1.8 Recently i upgrade to Ruby 1.9.2 and this routine start failing. It closes the IE if it is open but then not opening the new IE it just came out of script throwing error. Any suggestion how can i use it in 1.9.2? Bhavesh -- 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 .value method in watir
Hi, Im trying to insert text using ".value" method in watir script. I used like this. $ie.text_field(:id, $1).value=("ChineseData") When script executes, it shows this data in that text filed, but actually it is not inserted in the text filed. When i click submit, it throws error that filed is empty. What is the cause? how can i resolve this? I cannot use .set method as i have utf8 or special characters. Can someone help me out with this. Your help is appreciated. Thanks Bhavesh -- 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] I18n support in watir/ruby.
Hi, I have some chinese, french characters in the description filed of an application. I have to match that through watir/ruby scripts. But in CLI, it appears as juncked and thus pattern match failed. Do anyone know how to match I18n characters in watir? Do i need to install any addon for this to work? Any help would be highly appreciated. Thanks Bhavesh -- 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] How to suppress warning thrown by Watir.
Hi, I have to collect text from al the frames into one variable and then have to pattern match it. But problem is like some frames exists sometime and sometime not. So i rescued it, but still i see warning like -- failed Unable to locate a frame with id flatViewFrame PASSED! Page contains text - Version 4.4.0 So how can i suppress these warning "failed Unable to locate a frame with id flatViewFrame" I tried using like this -- exists?text1 += $ie.frame(:id, 'flatViewFrame').text But no effect, it is still showing me warnings. so is there any other way to suppress warnings. -- 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 watir reads page source? how ie.html works?
Hi John, thanks a lot, it worked. thanks again, bhavesh On Feb 19, 7:39 pm, JArkelen wrote: > Connect to the frame, so instead of: > > ie.link(:id, 'some_link').click > > use: > > ie.frame(:id, 'tableViewFrame').link(:id, 'some_link').click > > Cheers, > John > > On Feb 19, 7:14 am, Bhavesh wrote: > > > > > Hi, > > > Currently i am using ie.html and ie.text to get the page source and > > then > > using this i can actaully clicking on the objects etc. > > > However there are some changes done recently of EXTJS and now im not > > able to see > > page source. It is now like frame wise. > > > When talked with developer, it is replied like now page source is > > frame > > wise. > > > Earlier i use this command to get page source -- > > > “javascript:'' + window.document.body.outerHTML+ ''” > > > But now it is -- > > > “javascript:''%20+ > > %20document.getElementById("flatViewFrame").contentWindow.document.body.out > > erHTML > > +%20''” > > > “javascript:''%20+ > > %20document.getElementById("tableViewFrame").contentWindow.document.body.ou > > terHTML > > +%20''” > > > So i dont know what Watir uses bydefault or internally? > > > I there any way i can change it in Watir so that i can get the source. > > > If i fire my script it is failing. > > > in my script i verifying text appearing on the page, and uisng ie.html > > for it, but it is failing as it is not able to grap the complete page > > source. > > > Bhavesh- 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 watir reads page source? how ie.html works?
Hi, Currently i am using ie.html and ie.text to get the page source and then using this i can actaully clicking on the objects etc. However there are some changes done recently of EXTJS and now im not able to see page source. It is now like frame wise. When talked with developer, it is replied like now page source is frame wise. Earlier i use this command to get page source -- “javascript:'' + window.document.body.outerHTML+ ''” But now it is -- “javascript:''%20+ %20document.getElementById("flatViewFrame").contentWindow.document.body.outerHTML +%20''” “javascript:''%20+ %20document.getElementById("tableViewFrame").contentWindow.document.body.outerHTML +%20''” So i dont know what Watir uses bydefault or internally? I there any way i can change it in Watir so that i can get the source. If i fire my script it is failing. in my script i verifying text appearing on the page, and uisng ie.html for it, but it is failing as it is not able to grap the complete page source. Bhavesh -- 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 link with CTRL key pressed in watir?
Actually currently i press CTRL key manually and then the link, it gets opened. But while automating how can i do this? Plz dont suggest to remove pop-blocker as i have already done whatever i can, now i have soem restriction from my office side. So i need to send CTRL+link click. Can anybody help me in this regard. Bhavesh --~--~-~--~~~---~--~~ 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 can i click CTRL key + Link in Watir
Hi , I have to click CTRL key + link using watir. Is anybody know how to do it? Actually i can tmodify any setting in IE, os i have to press CTRL key manually and then link to open an link. But for automation, i have to do it using WATIR Any help is appreciated. Bhavesh --~--~-~--~~~---~--~~ 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 select rows under grid for EXTJS code using watir.
Hi, I have to select the row under Grid which is an extjs code. When we have a grid, and want to select a "row" in the grid, for some reason we cannot select it. We have sent click events and it appears that we're getting the "right row" (watir highlights the row in the browser), but our app code doesnt get the event from ext-js. Can some one help me how can i click/select this row, so that i can go ahead. Any help is appriciated. Bhavesh --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---