[Wtr-general] How to differentiate between a 'clicked' a 'disabled' or 'greyed-out' tab
Hello people, As part of testing with Watir, I want to check whether a particular tab (in a table) is in a 'clicked' (one that is currently clicked) state or in a 'disabled' (greyed-out or inaccessible ) state. I am not able to distinguish between a that is clicked and a tab that is disabled using the existence (.exists?) or the enabled/disabled (.enabled?/.disabled?) functions, the only two functions that I could think of for finding a solution. To be more precise, $ie.frame('Detail').cell(:text,'Instructions').exists? $ie.frame('Detail').cell(:text,'Instructions').enabled? returns 'true' and 'false' for the 'Instructions' tab that is in a 'clicked state' $ie.frame('Detail').cell(:text,'Step 2.Inventors').exists? $ie.frame('Detail').cell(:text,'Step 2.Inventors').enabled? returns 'true' and 'false' for the 'Step 2.Inventors' tab that is in a 'disabled state' Since both these answers are same, how to differentiate a 'clicked' tab from a 'disabled' tab through Watir? Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Can an 'excel' file be renamed with a Watir command?
Hello people, I have got a script that creates an 'excel_file' while running. After running, I want to rename it so that next time, when the script is run, it will create the excel file anew. Can I do that? I tried a few DOS commands but I could find only two DOS commands working in Watir. They are 'Dir.mkdir(directory)' and 'rmdir(directory)' Thanks, in Advance, Vijay ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can an 'excel' file be renamed with a Watir command?
Thank you areed for your answer. That was what I needed. It is working perfectly. Also, cmcmahon, I would definitely try to read the 'Ruby Language Help' file. Thanks, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] A query on Watir - Will watir/firewatir work on Linux?
Hello people, Will watir/firewatir work on Linux? (One of the clients of my company asked it this question. The concerned person of my company asked me and I am inturn asking you people). I had went through some web pages related to this. But, I am not able to gather a cyrstal-clear answer to the question (i am not aware of certain technical jargons that were being used in these pages). Now, I want to know two things: 1. Will watir/firewatir work on Linux? (at this point, I am sure which flavor of Linux the client uses. I believe, the client would be using 'Red Hat Linux') 2. Is Firewatir completely operational like Watir? (though, I could see that firewatir is being used currently, I just wants a confirmation from the appropriate persons) Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Need to check whether a message indicating whether
Hello people, In our application, there are a few text_fields and a save button. When the 'save' button is clicked without giving any input for any of these text fields, the application would display a text, ' * Required' besides the appropriate text field but in the same window. Now, I want to check whether this ' * Required' text is given out besides a text field when the 'save' button is clicked without giving input for that text field. How can I do that? The ' * Required' text is always present in the fourth column of the table cell in which each of the text fields are present. It is present as a 'span' with a few properties, including the 'id' property. No matter whether the ' * Required' text is present or not on the screen, the command 'ie.text' outputs the ' * Required' text because it is permanently present in a table cell. The only indication for the presence of the ' * Required' text is that the change of values for two of the enclosing span's properties named display(c ss) and isValid. When the ' * Required' text is present, the enclosing span's display(css) property has a value none and the enclosing span's isValid property has a value 0. When the ' * Required' text is present, the enclosing span's display(css) property has a value inline and the enclosing span's isValid property has a value -1. In this situation, how do I check whether the ' * Required' text is actually given out or not? Thanks in Advance, Vijay ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can we use as many variable names without worrying about memory wastage
Thanks for all your answers. They were really helpful to me. One small question, do we need to invoke Garbage Collector explictly and if so, how? Thanks, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] .Can we set the Watir's time_out_value in the script?
Thanks Jlolis for your reply. It is exactly what I had wanted. Thanks, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] How to check for the presence of a frame in a page?
Hello people, Our application has got several frames. The controls need to be accesses through these frames like '$ie.frame('Detail').link(:text,'Disclosure').click'. Before certain statements of this type, I want to check whether the particular frame is present in the current page or not. How do I do that? The '.exists?' method does not seem to work for a frame. If we check a frame, which is not present in the current page, through the '.exists?' method, Watir throws an exception saying Unable to locate the given frame. Thanks for your time, Vijay ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Converts DOM Tree into XML file.
Hi people, I just want to know , how to convert The DOM Tree Structure into a XML file format..? And also can we save the DOM tree Structure from the IE's DOM Explorer.? Thanks, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Rarely, watir does not wait till the browser gets loaded fully
Hello people, Rarely, Watir starts the execution of a statement before the brwoser gets loaded fully from the previous step's execution. What to do in those situation? Is there any statement in Watir that will tell its script to wait for a particular frame or a table before resuming the execution? Also, is there a statement in Watir that will make its script wait for a particular number of seconds? Thanks for your time, Vijay ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Can variables be used as regular expressions?
Hello people, Can variables be used as regular expressions in Watir? For example, if we want to check whether there is a link with 'href' containing a particular text say 'submitpage', we can say, puts (ie.link(:href,/submitpage/).exists?) Simiarly can we do the following. variable_for_holding_text = 'submitpage' puts (ie.link(:href,/variable_for_holding_text /).exists?) In this, instead of the exact text, I have passed the variable, 'variable_for_holding_text'. This situation will arise when we use want to do such a check within an user-defined function. Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can variables be used as regular expressions?
Thank you so much ZeljkoFilipin. Your answer had clarified my doubt. Thanks, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Can we use as many variable names without worrying about memory wastage
Hello people, Can we use as many variable names as we want in a script without worrying about the memory wastage? Each variable is going to occupy some bytes in memory and those bytes would remain occupied as long as the script is running. If so, then in order to avoid memory wastage, to the maximum possible extent, we need to use as few variables as possible in the script. Is this right? Can I make Watir free the memory space occupied by a variable once I find that the variable is not needed anymore? Thinking on the lines of not wasting memory, I am using same variables again and again in the script. If I could find out a way, through you people, to free the memory space occupied by a variable, I would use several variables with appropriate names in the script. Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] .Can we set the Watir's time_out_value in the script?
Hello people, In our application, there are is a dialog box, which takes a lot of time to load. We give the statement, 'ie.modal_dialog', at the point, where the dialog box would come. But this statement times out within a few seconds before the modal dialog gets loaded. While executing the 'ie,modal_dialog' statement, Watir throws an exception saying Modal dialog did not appear within 2.0 seconds. So we opened the 'watir.rb' file and increased the '@@attach_timeout' value present in it from 2.0 to 20.0. Now Watir waits for the dialog to come (which would come within 15 seconds) and attaches to it. Can we increase this 'attach_timeout' value through a watir command instead of opening the 'watir.rb' file and doing that manually (In a testing tool named 'Test Partner', we can do the same with the command, 'timeout_msec = 20')? Thanks for your time, Vijay. ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] A small doubt in Ruby
Thank you Zeljko Filipin. That was an useful and an interesting '.pdf'. Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6739messageID=19525#19525 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] A small doubt in exception handling
Thank you so much Charley. Your answer was exactly what I had wanted. Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6777messageID=19526#19526 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] A small doubt in exception handling
Hello people, Is there a way in Watir by which one can capture the line number of the code that threw an exception? We can get the actual message in the exception from the gloabl variable '$!'. Can we get the code's line number, which caused this exception, from some other global variable? For example, the following code: begin print z rescue puts The exception message was + $!.to_s end would output the message, 'The exception message was undefined local variable or method `z' for #Object:0x2ac9258'. But without the 'begin -- rescue class;, the code would have printed the error message, 'file_name.rb:117 (or some other line number): undefined local variable or method `z' for #Object:0x2ac9258 (NameError) I want to use the 'begin -- rescue class' and still get the exact line number along with the error message. Is that possible? Thanks for your time, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6777messageID=19510#19510 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] A small doubt in Ruby
Thank you Zeljko Filipin. I did not know about this '.dup' method before. That was an useful information. But is what Ruby doing (pointing two different variables to one string just because one variable's value was assigned to another in the previous step) correct? Shouldn't it consider the two variables as separate entities rather than one? Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6739messageID=19508#19508 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] A small doubt in Ruby
Hello people, Recently, when I was executing a simple Watir script, I noticed a small difference in the behaviour of Ruby. The code is: a = 'maloy' b = a puts a puts b a.chop! puts a puts b The output that I expected was: maloy # value of a maloy # value of b malo# value of chopped 'a' maloy # value of original 'b ' But the output given by Ruby was: maloy # value of a maloy # value of b malo# value of chopped 'a' malo# value of chopped 'b ' Is the output given out by Ruby correct? Why should Ruby chop the value of the variable 'b' when it was not asked to do that? (It was asked to chop the value of the variable 'a' only). Thanks for your time, Vaidyalingam. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6739messageID=19392#19392 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] OT: algorithm help?
Hello cmcmahon, When I read your query, I thought of a very very primitive method to perform your task. Though I firmly believe that you would want a far more elegant method to deal with your problem, just out of an anxiety, I am giving the method in the form of the script below: require 'Watir' include Watir input_excel_file = 'C:\trials\percentages.xls' # This input excel file will contain values for the number of iterations to be run along with the percentage of times the methods, a, b and c, needs to be called # The simple form of this sheet can contain 2 rows of data with headers (number of iterations, percentage of method a, percentage of method b and percentage of method c) in the first row # The second row will contain the values for these headers. excel = WIN32OLE::new('excel.Application') workbook = excel.Workbooks.open(input_excel_file) worksheet = workbook.Worksheets(1) worksheet.Select number_of_iterations = worksheet.cells(2,1)['Value'] a_percentage = worksheet.cells(2,2)['Value'] b_percentage = worksheet.cells(2,3)['Value'] c_percentage = worksheet.cells(2,4)['Value'] a_value = int(a_percentage * number_of_iterations/100) b_value = int(b_percentage * number_of_iterations/100) c_value = int(c_percentage * number_of_iterations/100) for i in 1..a_value a end for i in 1..b_value b end for i in 1..c_value c end Thanks for your time, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6528messageID=18873#18873 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] 'http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel', is not working
yes, arkie, the link is working. Probably, the link would have been down on that day. I am sorry for my haste in raising this issue in this forum. Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6520messageID=18875#18875 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to make Watir hit the 'key', which does a right-click, in the keybo
Thanks Ogre for your help. Your answer was precisely what I had expected. But I noted a small discrepancy. Though I was able to focus the 'Advanced Search' or any other link or any button in the page and right-click on the focussed link or button, I was not able to do the same for a text field. The below lines, ie.link(:text,'Advanced Search').focus ie.send_keys({APPSKEY}) when executed, right-click on the 'Advanced Search' link whereas the similar lines below, ie.text_field(:name,'q').focus ie.send_keys({APPSKEY}) when executed, does not right-click the 'text field' where the 'search text' is entered but it right-clicks the 'Address Bar'. Does this indicate a problem? Thanks again, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6545messageID=18862#18862 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to make Watir hit the 'key', which does a right-click, in the keybo
Hello Ogre, Thank you so much for your reply. Your answer was very correct. I was just trying to make Watir right-click on any control (text_field, link etc.) present in a web page. Now also, I am not sure how to focus a particular control before right-clicking on it through the command, ie.send_keys({APPSKEY}). ie.send_keys({APPSKEY}) does a right-click on the current cursor position. Can I make this right-click happen on a particular control. For example, can I make it right-click the link named 'Advanced Search' appearing in the page, 'www.google.com'? I wanted to click this 'APPSKEY' because I did not know how the command for right-clicking the mouse button. If you know the command for right-clicking the mouse button, it would be great. Thanks, Vaidyalingam - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6545messageID=18706#18706 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] how to make Watir hit the 'key', which does a right-click, in the keyboard
Hello people, I do not know how to make Watir hit the key, hitting which is equivalent to doing a right click with the mouse, using the 'send' command of Watir. The command, $ie.send({ENTER}), will hit the 'ENTER' key on the keyboard. Similarly, I want to hit the 'right-clicking key' but I do not know how to denote it in the 'send' command (ie) I do not know what to put inside the paranthesis p.s: This right-clicking key is usually present next to the right side 'Windows' key. Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6545messageID=18670#18670 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] 'http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel', is not working
Thank you bb-tester for your 'Scripting_Excel html file'. I appreviate your presence of mind in having that page saved. Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6520messageID=18572#18572 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] 'http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel', is not working
Hello people, The link, 'http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel', is not working. Please, if any of you people, know the updated link, let me know. Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6520messageID=18567#18567 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to access a modal dialog box to select a
Bret, I think It is a modal_dialog box because Watir is able to close the box through the command 'ie.modal_dialog.close'. Also, the command, puts ie.modal_dialog.html outputs the '.html' of the dialog as the following: HTMLHEADTITLESelect/TITLE SCRIPT language=javascript !-- function init() { indow.returnValue = null; var savedIDs = ; var excludeID = ; var frameURL = ../Common/SelectLookupItem.aspx?FullListLookupType=LOCTYPEFULL; if (savedIDs.length 0) frameURL = frameURL + SavedIDs= + savedIDs; if (excludeID.length 0) frameURL = frameURL + ExcludeID= + excludeID; document.all.PopupFrame.src = frameURL; } function FrameCallback(selectedIDs) { window.returnValue = selectedIDs; window.close(); } // -- /SCRIPT /HEAD BODY onload=init(); MS_POSITIONING=GridLayoutIFRAME id=PopupFrame style=Z-INDEX: 5; WIDTH: 100%; POSITION: absolute; HEIGHT: 100% marginWidth=0 marginHeight=0 src=../Common/SelectLookupItem.aspx?FullListLookupType=LOCTYPEFULL frameBorder=0 noResize scrolling=yes /IFRAME/BODY/HTML I am sorry to say that I do not know how to use this '.html' to select a particular value from the dialog box and click the 'Ok' button to confirm the selection. Please help me to do this. Thank you for your time, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6357messageID=18074#18074 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to access a modal dialog box to select a
Hello people, I tried a few commands in an attempt to get more details about the objects in the modal dialog box. 1. Output of the command, puts ie.modal_dialog.frame(:index,1).html HTMLHEADTITLE/TITLELINK href=../../styles/css_remote/styles.css type=text/css rel=stylesheet/HEADBODY class=bodydialogFORM id=Form1 name=Form1 action=EmptyPage.aspx method=postINPUT type=hidden value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= name=__VIEWSTATE /FORM/BODY/HTML 2. output of the command, puts ie.modal_dialog.frame(:index,1).show_all_objects text/css id= hiddenname=__VIEWSTATEid= value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= alt= src= 3. Output of the command, puts ie.modal_dialog.frame(:index,1).text Blank 4. Output of the command, puts ie.modal_dialog.frame(:index,1),form(:id,'Form1').html FORM id=Form1 name=Form1 action=EmptyPage.aspx method=postINPUT type=hidden value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= name=__VIEWSTATE /FORM 5. Output of the commands, puts ie.modal_dialog.frame(:index,1).form(:id,'Form1').show_all_objects and puts ie.modal_dialog.frame(:index,1).form(:index,1).show_all_objects ---Objects in page - hiddenname=__VIEWSTATEid= value=dDwtNjU0MzcyMTk1Ozs+2C7FwmeFdeDCpDsFGmQL7wdu1oU= alt= src= 6. Output of the command, puts ie.modal_dialog.frame(:index,1).form(:index,2).html c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1145/./watir.rb:2297:in `assert_exists': Unable to locate object, using index and 2 (Watir::Exception::UnknownObjectException) 7. Output of the command, puts ie.modal_dialog.frame(:index,1).form(:index,2).show_all_objects ---Objects in page - c:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1145/./watir.rb:1013:in `show_all_objects': undefined method `all' for nil:NilClass (NoMethodError) 8. Output of the command, puts ie.modal_dialog.frame(:index,1).text Blank I am not able to proceed anything beyond this. I do not know how to get the properties of the list of displayed values (from which I need to select a value) and the 'Ok' button. Also the command 'flash' is not 'flashing' the modal dialog box and the frame and the form within it. Please help me to make Watir to select a value from this dialog box and click the 'Ok' button.. Thanks for your time, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6357messageID=18107#18107 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Unable to access a modal dialog box to select a particular value from it
Hello people, In my application, when I select a particular value in a 'list box', a dialog named 'Select -- Web Page Dialog' gets displayed as a small window (1/4th the size of the original window). I want to select a particular value, among a list of values displayed, in this 'Dialog' and click the 'Ok' button in that. How do I do that? I think it is a modal dialog box. In this modal dialog box, there is a list of values displayed. How can I get the property (like id, name etc.) of this list to access it? Thanks, in Advance, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6357messageID=17920#17920 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Unable to access a modal dialog box to select a
Hello people, Thanks for your answers. But I am sorry to say that my issue still remains unsolved. $ie.modal_dialog.html does not return the '.html' of the dialog nor does 'Spysmith' reqcognize the controls in the dialog. The script just does not do anything after executing the statement prior to the statement that gives pops out the dialog ($ie.select_list(:id,'LBLocationTypeID').select 'Show Full'). After selecting 'Show Full' from the 'List Box', the script neither closes nor throws an error message. Is this a modal dialog box? (I am not able to click anything else, not even the IE developer toolbar, when it comes) How to select a particular value from it and click the 'OK' button on it? Just for your information, I would like to tell you that this web application was developed using 'ASP.NET' (I could say this as the 'URL' of the website has the word 'aspx' in it). Thanks, in Advance, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6357messageID=17990#17990 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Getting the current system date through a Watir command
Hello people, I do not know what command to use to make Watir output the current system date and to convert it into the desired format, dd-mon- (22-Jan-2007). I want the current system date inorder to check whether a particular field present in the application has the currrent date or not. If anybody could help me, I would be thankful. Thanks, in Advance Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6307messageID=17749#17749 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] how to make Watir output the current system date through a command
Hello people, I do not know what command to use to make Watir output the current system date and to convert it into the desired format, dd-mon- (22-Jan-2007). I want the current system date inorder to check whether a particular field present in the application has the currrent date or not. If anybody could help me, I would be thankful. Thanks, in Advance Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6308messageID=17750#17750 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to access a table present within a form?
Hello John Lolis, I appreciate your observation. Yes, indeed, I have been trying the statement with a 'commo' instead of a 'dot'. Now, when I replaced 'comma' with a 'dot', Watir is giving the desired output. I am very sorry for not observing the typographic error previously. Thanks, Vaidyalingam - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6277messageID=17742#17742 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] How to access a table present within a form?
Hello people, I do not know how to access a table present inside a form using Watir. This table is the first table (index = 1) of the html page. It is throwing an error for the command, result = ie.frame('builderFrame'),form(:name,'dummy').table(:index,1)[1][1].text but it is accepting the command. result = ie.frame('builderFrame').table(:index,1)[1][1].text Thanks, in Advance, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6277messageID=17652#17652 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to save the test result ?
Hi interstellar, Good that you have solved your problem yourself. But still, I would like give you a small piece of information, which I got from this forum. The below-given link will take you to a page that contains crystal-clear information about how to read from and write to excel files: http://wiki.rubygarden.org/Ruby/page/show/ScriptingExcel The below piece of code creates a simple html file and writes data to it: # variable definitions number_of_cols = 2 column_names = [Step number,Result] def create_html(file_path,number_of_cols,column_names) end_of_loop = column_names.length - 1 output_html_file = File.new(file_path, File::CREAT|File::TRUNC|File::WRONLY) output_html_file.write(table border = + number_of_cols.to_s + ) output_html_file.write(tr) for i in 0..end_of_loop output_html_file.write(tdb) output_html_file.write(column_names[i]) output_html_file.write(/b/td) end output_html_file.write(/tr) output_html_file.close end def write_result(file_path,step_number,result_or_results) output_html_file = File.open(file_path, File::APPEND|File::WRONLY) output_html_file.write(trtd) output_html_file.write(step_number) output_html_file.write(/tdtd) output_html_file.write(result_or_results[i]) output_html_file.write(br) output_html_file.puts(/td/tr) output_html_file.close end You may also find file handling information from the 'Basic Input/Output' section of the 'Ruby Guide': Start - Programs - Ruby - Ruby Documentation - Ruby Book Help - Basic Input Ouput Thanks and hope I have not wasted your time, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5918messageID=16562#16562 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] How to capture exception details
Thank you, Jlolis and Nathan. Your answers were really very helpful. Now, we are able to trap exception messages using your suggestion but is there any way to capture the line number of the code that made Watir throw an exception as it would be really helpful to see an exception note like the following: A 'so and so' exception has occured in 'so and so' line Also can the name of the function in which the exception was thrown, be captured? Ex. if we have written a small function called 'add_an_inventor'. If, within that function, an exception occurs, can we capture the name of the user-defined function so that our exception note would be still more elaborate as it would say, A 'so and so' exception has occured within the 'add_an_inventor' function in the 'so and so line Finally, can we make the script go to a particular line once it encounters an exception. Is there a goto statement in Ruby? Thanks, in Advance, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5886messageID=16516#16516 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to access an element whose html tag is A
Thank you, Zeljko, for your crystal-clear answer, using which the issue got resolved. Using the similar answer you have given to a different thread, I was unable to resolve the issue using that (because I was continually trying with the '.enabled' option and ignored the '.exists' options completely. I am sorry for that). If had dwelled a bit more on that answer or explored all of its options, the issue could have been resolved then. Two more questions, 1. How you came to know that there is a word called cell, which can be used to check the contents of a table cell. Is that documented somewhere? If so, can you point me to the link where all these different types of objects, which can be referred to in Watir, are given? 2. why does watir say undefined class 'element' for frame' when executing the following statement: ie.frame(Detail).element(:text,Step 2. Inventors).exists? Does'nt the word 'element' signify some general object? The following is for Bret, who had asked me to give the 'html' of disabled tabs (They are not recognized as links when they are in a 'disabled' state). Bret, the html for one of the disabled tabs is as follows: Active Element: [TD], Frame: [Detail], Index: [41] TD class=tab_disabled_label background=/iam/images/tab_inactive_bg.pngStepnbsp;2.nbsp;Inventors/TD Just for your information, the html of one of the enabled tabs is as follows: Active Element: [A], Frame: [Detail], Index: [35] A class=tab_enabled href=javascript:formSubmit('summary');Stepnbsp;1.nbsp;Details/A Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5711messageID=16467#16467 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to access an element whose html tag is A
Thank you, Zeljko, for your crystal-clear answer, using which the issue got resolved. Using the similar answer you have given to a different thread, I was unable to resolve the issue using that (because I was continually trying with the '.enabled' option and ignored the '.exists' options completely. I am sorry for that). If had dwelled a bit more on that answer or explored all of its options, the issue could have been resolved then. Two more questions, 1. How you came to know that there is a word called cell, which can be used to check the contents of a table cell. Is that documented somewhere? If so, can you point me to the link where all these different types of objects, which can be referred to in Watir, are given? 2. why does watir say undefined class 'element' for frame' when executing the following statement: ie.frame(Detail).element(:text,Step 2. Inventors).exists? Does'nt the word 'element' signify some general object? The following is for Bret, who had asked me to give the 'html' of disabled tabs. Bret, the html for one of the disabled tabs is as follows: Active Element: [TD], Frame: [Detail], Index: [41] TD class=tab_disabled_label background=/iam/images/tab_inactive_bg.pngStepnbsp;2.nbsp;Inventors/TD Just for your information, the html of one of the enabled tabs is as follows: Active Element: [TD], Frame: [Detail], Index: [36] TD class=tab_enabled IMG class=tab src=/iam/images/tab_right_inactive_noline.png/TD Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5711messageID=16466#16466 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] How to capture exception details
Hello, Can someone tell me how to handle exceptions (Watir::Exception::UnknownObjectException: Unable to locate object) in Watir such that Watir would write the exception message somewhere and continue with the script? Thanks, in Advance, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5886messageID=16475#16475 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] how to access an element whose html tag is A
Thanks for your suggestion. All the 7 elements in the page are recognized as links when they are in enabled states and in that situation, I am able to click all of them using 'ie.link' commands similar to the one given below: ie.frame(Detail).link(:text,Step 2. Inventors).click But, when the web page first loads, only one (it is displayed as Step 1. Details) out of the existant 7 elements is enabled and so only this element is recognized as a link by Watir. The status of this element can be checked by the following command: object_enabled = ie.frame(Detail).link(:text,Step 1. Details).enabled? The above command returns True to say that the element, Step 1. Details, is enabled. But I am not sure how to check the statuses of other elements as Watir does not recognize them as links because they are disabled. If a similar statement is used to check the element, Step 2. Inventors (which is in a disabled state), Watir says that it is unable to find out the object using text and Step 2. Inventors. The reason behind this, I believe, is that the element, Step 2. Inventors is not identifed as a link as it is in a disabled state (it is not categorized as a link because it cannot be clicked). So I am unable to find out the statuses of other elements because I am not sure what word to put instead of the word link in the following checking statement, object_enabled = ie.frame(Detail).link(:text,Step 2. Inventors).enabled? If I use the word, element instead of the word link in the above statement, Watir says Undefined method 'element' for Watir Frame The 'html' of all the disabled items are present as: Active Element: [TD], Frame: [Detail], Index: [41] TD class=tab_disabled_label background=/iam/images/tab_inactive_bg.pngStepnbsp;2.nbsp;Inventors/TD Thanks, in Advance, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5711messageID=16393#16393 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] how to access an element whose html tag is A
Hello people, I do not know how to access an element whose html tag is A. There is a link, named 'Step 1. Details'. According to its View Source, it is present in the following hierachy: frame - form - div - table and then that element but its html shows as A class = tab_enabled href = javascript:formSubmit('summary');). I want to know whether this element is enabled or disabled and want to click it, if enabled. Similarly, there are six other elements, 'Step 2. Details', 'Step 3. Contacts' etc. These elements will be disabled at the start. I want to confirm that. How do I do these two things? I tried a command, if ie.frame(Detail).form(:name,header).div(:id,header).table(:id,cIDFTabstripTable).element(:text,/Contacts/).enabled? == true then , but Watir says undefined method `element' for #Watir::Table:0x2ea6058 Thanks, in Advance. Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5711messageID=15977#15977 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Error while calling a function in Watir 1.5
Hello people, I have written a small function to check for the presence or absence of a few values within a table. Sometimes, Watir executes the function properly and gives the intended output (telling whether those values are present or not). But, at times, it is throwing one of the following error messages (after giving a few lines of output): 1. Ruby.exe has generated errors and will be closed by windows. You will need to restart the program in a small window with a title Program Error 2. [Bug] Segmentation Fault 3. Abnormal Program Termination I am using Ruby 1.85 and Watir gem 1.5.1.1127. Previuosly, when I told about the first error in a different message, Charley Baker told me to use Ruby 1.82 instead of 1.85. Are all the three error messages caused due to Ruby 1.85 or there could be a problem with my code (the function is a straight-forward function with little complications)?. Also I am unable to install Watir gem 1.5.1.1127 over Ruby 1.82. After uninstalling Ruby 1.85 and installing Ruby 1.82, when I give the command, gem install watir 1.5.1.1127.gem or gem install watir in the command prompt, Windows is giving out an error message saying, gem is not a recognizable command or a batch file (the error message that comes when we type in a non-existant command in DOS). Does gem needs to be installed separately before using the command gem install...? I used to install Watir 1.5.1.1127 over Ruby 1.85 in the above-mentioned way and it perfectly installs the Watir gem. Please help me. Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5638messageID=15717#15717 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] abnormal program termination error message while playing back a script
I am still unable to install Watir gem 1.5.1.1127 over Ruby 1.82. After uninstalling Ruby 1.85 and installing Ruby 1.82, when I give the command, gem install watir 1.5.1.1127.gem or gem install watir in the folder where the watir gem was downloaded, Windows is giving out an error message saying, gem is not a recognizable command or a batch file (the error message that comes when we type in a non-existant command in DOS). Does gem needs to be installed separately before using the command gem install...? I used to install Watir 1.5.1.1127 over Ruby 1.85 in the above-mentioned way and it perfectly installs the Watir gem. Thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5509messageID=15718#15718 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Error while calling a function in Watir 1.5
Good to hear it. But do you know how to install Watir 1.5.1.1127.gem over Ruby 1.82. When I give the command gem install Watir-1.5.1.1127 in the folder where the gem was downloaded to, Windows says gem is not a recognizable command or a batch file (the error message that comes when a wrong command is keyed in DOS) Thanks, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5638messageID=15722#15722 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Error while calling a function in Watir 1.5
Thanks Charley and Udof for your help. After installing Ruby 1.82, I put the watir gem in the 'C:\ruby\bin' folder and installed watir from there. Now the function, which used to throw a series of error messages like Program error - ruby.exe has created problems, segmentation fault and abnormal program termination, seems to run properly and give the intended output. Thanks, once again. That was a great help. Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5638messageID=15737#15737 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] abnormal program termination error message while playing back a script
Thanks everyone for your help. I put the watir gem in the 'C:\ruby\bin' folder and installed watir from there. Now the function, which used to throw a series of error messages like Program error - ruby.exe has created problems, segmentation fault and abnormal program termination, seems to run properly and give the intended output. Thanks, once again. That was a great help. Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5509messageID=15735#15735 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] abnormal program termination error message while playing back a script
Thanks Charley for your info. Now I have installed Ruby 1.82 (from the RubyForge site) after uninstalling Ruby 1.85. But now I am unable to install a watir gem. With Ruby 1.85, I would go to the directory where the gem (say 1.5.1.1127) was downloaded and type gem install watir-1[1].5.1.1127.gem (watir-1[1].5.1.1127.gem is the name of the gem file) to install the gem. But now, when I try to install the 1127 gem in the same way, I get an error message saying, watir-1[1].5.1.1127.gem. Is this not the way that a watir gem should be installed over Ruby 1.82? Can you guide me on how to install 1127 gem over Ruby 1.82? Many thanks, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5509messageID=15673#15673 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Checking whether images inside a table are enabled or disabled
Hi Ethan, Thanks for your reply and sorry for not explaining the issue clearly. There is a page in our application that contains links like Instructions, Step 1. Details, Step 2. Inventors etc [These are actually recognized as TDs in the 'View - Source. The table containing this has got an unique id to recognize it]. While entering into our application, all links, other than Instructions and Step 1. Details, should be disabled. This means that one can click on only the above-mentioned two links (Instructions and Step 1. Details). The other links will be grayed out and cannot be clicked on (they will appear as just words with no hand-pointer , one which gets displayed when the mouse traverses over a web link). I want to verify this with Watir. I am at a loss about how to do that. A sample html for an enabled link is : Active Element: [A], Frame: [Detail], Index: [35] A class=tab_enabled href=javascript:formSubmit('summary');Stepnbsp;1.nbsp;Details/A) ]. A sample html for a disabled link is: Active Element: [TD], Frame: [Detail], Index: [41] TD class=tab_disabled_label background=/iam/images/tab_inactive_bg.pngStepnbsp;2.nbsp;Inventors/TD Hope this gives you a clearer picture. Thanks, in advance, for your help. Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5565messageID=15596#15596 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] Checking whether images inside a table are enabled or disabled
Hello people, I have got to check whether images present in a table are enabled or disabled. I am not even very sure whether they are images. Their html content: is like the following: td class=tab_enabledimg class=tab src=/iam/images/tab_left_inactive.png/td td class=tab_enabled background=/iam/images/tab_inactive_bg.png/tdtd class=tab_enabled_label background=/iam/images/tab_inactive_bg.png class=tab_enabled a class=tab_enabled href=javascript:formSubmit('summary');Stepnbsp;1.nbsp;Details/a /td Is there a way that I can check whether this image (or link or label) is enabled or not? Thanks, in advance, Vijay - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5565messageID=15503#15503 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] abnormal program termination error message while playing back a script
Hi people, My name is Vijay. I am new to Watir. Occasionally, while playing back the script, which does a simple operation in our application, the script hangs with an error message, abnormal program termination, in its window (where the command, 'puts', will write its output). As said above, this is not always. Several times, the script plays back till the end. Also, occasionally, I do get a Program Error in a small window saying that Ruby.exe has had some problems. You may need to restart the program with an 'OK' button at the bottom. At those times, I just re-run the script and the script runs fine. I am using 'Ruby 185-21' and 'Watir gem', 1.5.1.1127. Is there a problem with the installation? I have, a few times, uninstalled and re-installed 'Ruby' and 'Watir gem'. Previously, I was using 1.5.1.1100 and this error had not occured even once. I uninstalled 1.5.1.1100 and installed 1.5.1.1127 because 1.5.1.1100 was not allowing the script to handle pop-up windows. It was throwing an error in the statement, require 'watir/contrib/enabled_popup', while trying to handle pop-ups. Thanks, in Advance, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5509messageID=15336#15336 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Can't Control JavaScript PopUp Window....
Hi Sandeb, I also used to get that error in the 'enabled_popup' line but it does not seem to come after the previous version of 'watir gem' (1.5.1.1100) was uninstalled and the latest version (1.5.1.1127) was installed. Try that. It may work for you also. You may install the latest version of watir gem from the link given below: http://wiki.openqa.org/display/WTR/Development+Builds The piece of code that is currently being used to handle popups (simple function - just clicks the 'Ok' button of the popup window) in our script is (got from one of the forums): # should use 'click_no_wait' in the below statement and not 'click' ie.frame(Toolbar).link(:text,Log out).click_no_wait hwnd = ie.enabled_popup(5) # get a handle if one exists if (hwnd) # yes there is a popup w = WinClicker.new w.makeWindowActive(hwnd) w.clickWindowsButton_hwnd(hwnd, OK) end along with the statement, require 'watir/contrib/enabled_popup' , at the begining of the script. Hope, the reply was useful. Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5505messageID=15330#15330 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
[Wtr-general] list of watir commands
Hi people, I have got a small doubt. Is there some place where one can find the list of commands that are available in Watir. When I went through this forum searching for some issue, I found a lot of new commands like clickWindowsButton, clickWindowsButton_hwnd, ie.enabled_popup(5) etc. If there a repository for all these available commands, then it would be greatly helpful. Thanks, in Advance, Vijay. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5512messageID=15340#15340 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general