Re: [wtr-general] How to get the status of http
Yes, it works , thank you very much 2011/5/23 Amit Bobade amit.sr...@gmail.com Dear Qiannan, Here is the answer of you question. Use following code. This is working code. I used this in my scripts. require 'net/http' require 'uri' def page_status url url = URI.parse(url) http = Net::HTTP.new(url.host, url.port) http.start do http.request_get(url.path.empty? ? / : url.path) do |res| return {:name = res.class, :code = res.code} end end end status = page_status(http://www.yourURL.com;) # Printing response class and status. puts res_class=status[:name] puts stat=status[:code] On Sat, May 21, 2011 at 9:25 PM, Qiannan Zhang qian...@ecitysky.comwrote: Hi, all I need help, i do not know how to get the status of http, is there anyone know how to do? thanks -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Thanks and Regards, Amit -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Watir Podcast #45: Bret Pettichord’s Opening Keynote at Selenium Conference 2011
I enjoyed it too. Especially the scientific method. Try it, see if it works. Ever since I read Bach's Test Automation Snake Oil in '96, I've always tried to follow sound principles. I've also tried to learn from mistakes, even those that others have made. I still think that recorders are good for something, though. I like capturing the objects' details quickly that way. With that in mind, though, I think there could be a more effective way to do that. Maybe that could be a way to create the stubs of page objects. Dave -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: Need help on table dropdowns(iteration)
Thank you everyone, i figured out the answer for that issue. I used regular expressions with iteration and it did work perfectly. *Browser=$b.table(:id, /Grid/) $Browser.rows.each do |row| if (row[4].text =~ /Acct(.*) /) puts Dropdown selected row[5].select_list(:id, /dispositionList/).select Value from dropdown end end * On Fri, May 20, 2011 at 2:38 PM, Ashok Tulachan tulachanas...@gmail.comwrote: Thank you very much Chuck, for your response. I will take your advice and follow it graciously. However, When i tried to put your code as given below., i got the following error message. browser.table(:id, /grid/).rows.each do |row| row[5].select(Value from the dropdown) if row[4].text.exists? end Error *C:/Watir Scripts/Project/Debit.rb:58:in `block in report': undefined method `exists?' for Account Number:String (NoMethodError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriver/element_collection.rb:21:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriver/element_collection.rb:21:in `each' from C:/Watir Scripts/Project/Debit.rb:57:in `report' from driver.rb:36:in `run' from driver.rb:42:in `main'* ** So i tried to tweak the script and wrote as below. browser.table(:id, /Grid/).rows.each do |row| if row[4].text!= row[5].select(Value from the dropdown) end Then i got the following error message. *C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriver/container.rb:36:in `extract_selector': expected Hash or (:how, 'what'), got [Exclude: Duplicate Account] (ArgumentError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriver/elements/generated.rb:2163:in `select' from C:/Watir Scripts/Project/Credit.rb:53:in `block in liability_report' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriver/element_collection.rb:21:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriver/element_collection.rb:21:in `each' from C:/Watir Scripts/Project/Credit.rb:51:in `liability_report' from driver.rb:36:in `run' from driver.rb:42:in `main'* ** So i think we need to use (how, what) expressions, can you help me how to use those expressions in 'each' command? Thanks * * Ashok Tulachan On Fri, May 20, 2011 at 11:43 AM, Chuck van der Linden sqa...@gmail.com wrote: Try something along these lines. browser.table(:id, /grid/).rows.each do |row| row[5].select(Value from the dropdown) if row[4].text.exists? end and for the sake of anyone having to read your code (including yourself) start using variable names that mean something instead of c or d (which reminds me of code I wrote back in 1974 in early versions of basic) On May 20, 7:11 am, Ashok Tulachan tulachanas...@gmail.com wrote: No answers yet :(... I am able to select the dropdown for the respective row but i'm not just able to iterate it. Table name: $b.table(:id, /grid/) 1 2 3 4 5 2 100 100 3 100 100 text dropdown 4 100 100 5 100 100 text dropdown n 100 100 *i=0* *c=$b.table(:id, /grid/)[2][4]* *d=$b.table(:id, /grid/)[2][5]* I can select the dropdown in column 5 if i use the following code while i$b.table(:id, /grid/).row.length if c.text.exist?== true $d.select Value from the dropdown else exit end However since the row is infinite and n, i am not able to iterate, any help would be highly appreciated. Thanks, On Thu, May 19, 2011 at 9:51 AM, Ashok Tulachan tulachanas...@gmail.comwrote: Hello everyone, I am trying to do 'For' loop for the table but i am having a hard time as it involves iteration. *Scenario description:* I have a table where there are 'n' number of rows but fixed number(5) of columns as shown below. I need to select the dropdown in column 5 if the text presents in Column 4. Just to make clear the rows are infinite and can be any no. Table name: $b.table(:id, /grid/) 1 2 3 4 5 2 100 100 3 100 100 text dropdown 4 100 100 5 100 100 text dropdown n 100 100 Here's what i come up with. *i=0* *c=$b.table(:id, /grid/)[i][4]* *d=$b.table(:id, /grid/)[i][5]* ** ** *while i$b.table(:id, /grid/).row.length* * if c.text.exist?==true* *$d.select_list.select dropdown* *else* *puts No value present* *end* *end* i need to use for loop for iteration on this code. Any help from ruby expert will be appreciated. Regards, Ashok Tulachan -- Regards, Ashok Tulachan -- 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 -- Regards, Ashok Tulachan -- Regards, Ashok Tulachan -- Before
[wtr-general] Re: No able to click hyperlink showing in the tablecell
Given the HTML you have supplied, the code that Zeljko provided browser.link(:text = Update).click browser.link(:text = Cancel).click should work, If it is not working, we'll a better description of what 'not working' means. If there is an error message please provide it, if not a description of what exactly you see happening.. nobody here can see your screen nobody hear can read your mind you must use written words to communicate with us, in detail, results of things we suggest as solutions. this is not working is not communicating anything worthwhile and provides no path forward On May 18, 1:11 am, sandy sandix...@gmail.com wrote: have tried this option also but this is not working...Please suggest me something that work...this is like a table hierarchy and update cancel link is showing in a cell. As it is showing from the code for update and cancel below a href='javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(ctl00$cphMaster$MyDataGrid$ctl02$ctl00, , true, , , false, true))'Update/anbsp;a href=javascript:__doPostBack('ctl00$cphMaster$MyDataGrid $ctl02$ctl01','')Cancel/a/tdtd some java script function has been called on update cancel link... On May 16, 9:25 pm, orde ohil...@gmail.com wrote: Thanks for replying but these option is also not working. What exactly is happening? Is an error thrown? It's possible that the javascript needs to be triggered via a fire_event method (http://rdoc.info/gems/watir/1.8.1/Watir/ Element:fire_event): browser.link(:text = Update).fire_event(onclick) browser.link(:text = Cancel).fire_event(onclick) Hope it helps. orde On May 16, 7:28 am, sandy sandix...@gmail.com wrote: Thanks for replying but these option is also not working. Please let me know if there is an another solution of this problem. On May 13, 7:55 pm, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Fri, May 13, 2011 at 4:31 PM, sandy sandix...@gmail.com wrote: i am not able to click the update or cancel link Try this: browser.link(:text = Update).click browser.link(:text = Cancel).click Ž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: Need help on table dropdowns(iteration)
glad to hear it's resolved.. are you the same person asking about this over on stackoverflow? On May 23, 9:54 am, Ashok Tulachan tulachanas...@gmail.com wrote: Thank you everyone, i figured out the answer for that issue. I used regular expressions with iteration and it did work perfectly. *Browser=$b.table(:id, /Grid/) $Browser.rows.each do |row| if (row[4].text =~ /Acct(.*) /) puts Dropdown selected row[5].select_list(:id, /dispositionList/).select Value from dropdown end end * On Fri, May 20, 2011 at 2:38 PM, Ashok Tulachan tulachanas...@gmail.comwrote: Thank you very much Chuck, for your response. I will take your advice and follow it graciously. However, When i tried to put your code as given below., i got the following error message. browser.table(:id, /grid/).rows.each do |row| row[5].select(Value from the dropdown) if row[4].text.exists? end Error *C:/Watir Scripts/Project/Debit.rb:58:in `block in report': undefined method `exists?' for Account Number:String (NoMethodError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Watir Scripts/Project/Debit.rb:57:in `report' from driver.rb:36:in `run' from driver.rb:42:in `main'* ** So i tried to tweak the script and wrote as below. browser.table(:id, /Grid/).rows.each do |row| if row[4].text!= row[5].select(Value from the dropdown) end Then i got the following error message. *C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdri ver/container.rb:36:in `extract_selector': expected Hash or (:how, 'what'), got [Exclude: Duplicate Account] (ArgumentError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/elements/generated.rb:2163:in `select' from C:/Watir Scripts/Project/Credit.rb:53:in `block in liability_report' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Watir Scripts/Project/Credit.rb:51:in `liability_report' from driver.rb:36:in `run' from driver.rb:42:in `main'* ** So i think we need to use (how, what) expressions, can you help me how to use those expressions in 'each' command? Thanks * * Ashok Tulachan On Fri, May 20, 2011 at 11:43 AM, Chuck van der Linden sqa...@gmail.com wrote: Try something along these lines. browser.table(:id, /grid/).rows.each do |row| row[5].select(Value from the dropdown) if row[4].text.exists? end and for the sake of anyone having to read your code (including yourself) start using variable names that mean something instead of c or d (which reminds me of code I wrote back in 1974 in early versions of basic) On May 20, 7:11 am, Ashok Tulachan tulachanas...@gmail.com wrote: No answers yet :(... I am able to select the dropdown for the respective row but i'm not just able to iterate it. Table name: $b.table(:id, /grid/) 1 2 3 4 5 2 100 100 3 100 100 text dropdown 4 100 100 5 100 100 text dropdown n 100 100 *i=0* *c=$b.table(:id, /grid/)[2][4]* *d=$b.table(:id, /grid/)[2][5]* I can select the dropdown in column 5 if i use the following code while i$b.table(:id, /grid/).row.length if c.text.exist?== true $d.select Value from the dropdown else exit end However since the row is infinite and n, i am not able to iterate, any help would be highly appreciated. Thanks, On Thu, May 19, 2011 at 9:51 AM, Ashok Tulachan tulachanas...@gmail.comwrote: Hello everyone, I am trying to do 'For' loop for the table but i am having a hard time as it involves iteration. *Scenario description:* I have a table where there are 'n' number of rows but fixed number(5) of columns as shown below. I need to select the dropdown in column 5 if the text presents in Column 4. Just to make clear the rows are infinite and can be any no. Table name: $b.table(:id, /grid/) 1 2 3 4 5 2 100 100 3 100 100 text dropdown 4 100 100 5 100 100 text dropdown n 100 100 Here's what i come up with. *i=0* *c=$b.table(:id, /grid/)[i][4]* *d=$b.table(:id, /grid/)[i][5]* ** ** *while i$b.table(:id, /grid/).row.length* * if c.text.exist?==true* *$d.select_list.select dropdown* *else* *puts No value present* *end* *end* i need to use for loop for iteration on this code. Any help from ruby expert will be appreciated. Regards, Ashok Tulachan -- Regards, Ashok Tulachan -- Before posting, please
Re: [wtr-general] Re: Need help on table dropdowns(iteration)
That's correct Chad. I was struggling days and days to figure out this issue. Well thanks for helping me out on both sources :). On Mon, May 23, 2011 at 12:37 PM, Chuck van der Linden sqa...@gmail.comwrote: glad to hear it's resolved.. are you the same person asking about this over on stackoverflow? On May 23, 9:54 am, Ashok Tulachan tulachanas...@gmail.com wrote: Thank you everyone, i figured out the answer for that issue. I used regular expressions with iteration and it did work perfectly. *Browser=$b.table(:id, /Grid/) $Browser.rows.each do |row| if (row[4].text =~ /Acct(.*) /) puts Dropdown selected row[5].select_list(:id, /dispositionList/).select Value from dropdown end end * On Fri, May 20, 2011 at 2:38 PM, Ashok Tulachan tulachanas...@gmail.com wrote: Thank you very much Chuck, for your response. I will take your advice and follow it graciously. However, When i tried to put your code as given below., i got the following error message. browser.table(:id, /grid/).rows.each do |row| row[5].select(Value from the dropdown) if row[4].text.exists? end Error *C:/Watir Scripts/Project/Debit.rb:58:in `block in report': undefined method `exists?' for Account Number:String (NoMethodError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Watir Scripts/Project/Debit.rb:57:in `report' from driver.rb:36:in `run' from driver.rb:42:in `main'* ** So i tried to tweak the script and wrote as below. browser.table(:id, /Grid/).rows.each do |row| if row[4].text!= row[5].select(Value from the dropdown) end Then i got the following error message. *C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdri ver/container.rb:36:in `extract_selector': expected Hash or (:how, 'what'), got [Exclude: Duplicate Account] (ArgumentError) from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/elements/generated.rb:2163:in `select' from C:/Watir Scripts/Project/Credit.rb:53:in `block in liability_report' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.2.3/lib/watir-webdriv er/element_collection.rb:21:in `each' from C:/Watir Scripts/Project/Credit.rb:51:in `liability_report' from driver.rb:36:in `run' from driver.rb:42:in `main'* ** So i think we need to use (how, what) expressions, can you help me how to use those expressions in 'each' command? Thanks * * Ashok Tulachan On Fri, May 20, 2011 at 11:43 AM, Chuck van der Linden sqa...@gmail.com wrote: Try something along these lines. browser.table(:id, /grid/).rows.each do |row| row[5].select(Value from the dropdown) if row[4].text.exists? end and for the sake of anyone having to read your code (including yourself) start using variable names that mean something instead of c or d (which reminds me of code I wrote back in 1974 in early versions of basic) On May 20, 7:11 am, Ashok Tulachan tulachanas...@gmail.com wrote: No answers yet :(... I am able to select the dropdown for the respective row but i'm not just able to iterate it. Table name: $b.table(:id, /grid/) 1 2 3 4 5 2 100 100 3 100 100 text dropdown 4 100 100 5 100 100 text dropdown n 100 100 *i=0* *c=$b.table(:id, /grid/)[2][4]* *d=$b.table(:id, /grid/)[2][5]* I can select the dropdown in column 5 if i use the following code while i$b.table(:id, /grid/).row.length if c.text.exist?== true $d.select Value from the dropdown else exit end However since the row is infinite and n, i am not able to iterate, any help would be highly appreciated. Thanks, On Thu, May 19, 2011 at 9:51 AM, Ashok Tulachan tulachanas...@gmail.comwrote: Hello everyone, I am trying to do 'For' loop for the table but i am having a hard time as it involves iteration. *Scenario description:* I have a table where there are 'n' number of rows but fixed number(5) of columns as shown below. I need to select the dropdown in column 5 if the text presents in Column 4. Just to make clear the rows are infinite and can be any no. Table name: $b.table(:id, /grid/) 1 2 3 4 5 2 100 100 3 100 100 text dropdown 4 100 100 5 100 100 text dropdown n 100 100 Here's what i come up with. *i=0* *c=$b.table(:id, /grid/)[i][4]* *d=$b.table(:id, /grid/)[i][5]* ** ** *while
[wtr-general] Re: UnknownObjectException when trying to access a select list that clearly exists.
Not inside frame, same error occurs if form not used (i.e. directly from full browser container), names and ids where exist are spelled correctly in my scripts. only one form, name values are static have tried access by index with same results one of my colleagues has been able to select an option using :xpath access but get same error trying to capture selected value for verification. not my employer's ip, but a third party and access is by password protected logon which I cannot give out no matter what the name and id attributes contain. Am contractor and just being belt and suspenders careful. The quoted HTML is copy and paste except for those substitutions. The exception only occurs only when the select tag contains non- standard attribute 'type=Text' All other select tags (quite a few now) so far encountered in this application confirm that with 'type=Text' [sic with the capital T] the error occurs, with a standard select tag structure all is well. The option tag is also non-standard (bare attribute 'selected' instead of standard 'selected=selected') I'll be digging further into Watir code with debug and see whether I can narrow down where things are getting confused. Thanks for the suggestions and keeping me honest ;-) pat On May 18, 2:07 pm, Chuck van der Linden sqa...@gmail.com wrote: Your first step in the IRB is failing to identify the object using the name you provided form=browser.form(:name,'userdata') = #Watir::Form:0x3859f08 located=false how=:name what=userdata select_list=form.select_list(:name,'somename') Notice it says 'located = false' it could not find a form on the page with that name. is it inside a frame? did you spell the name right? is there more than one form on the page with the same name? do the name values change dynamically? providing un=edited HTML would be best. I respect you are trying to protect your employer's IP, but I fail to see how name or ID's can be 'proprietary' as any user viewing the page when using your product would easily see those values and they generally reveal very little about the backend server code that creates them (which is the real IP that needs to be kept secret). Client side code is open to the world, it generally travels the internet unencrypted and is visible to anyone anytime who knows enough to use a right click to view the page source, or a tool like netmon or fiddler to intercept the HTTP traffic. You have no secrets once your page hits the user's browser and there's no 'magic' in a name or ID value that anyone here is going to be able to steal from your employer. On May 17, 8:22 pm, koicat pmn...@yahoo.com wrote: Keep getting an UnknownObjectException when trying to access a select list. Possible oddities: select tags in this application use type attribute. (See the html views below) HTML is -//W3C//DTD HTML 4.0 Transitional//EN and I don't find reference to using the type attribute with select tags in HTML 4.0. Also the one that works shows selected option with 'selected=selected', the naughty one just shows 'selected' (See the script views below) The one that fails (from an irb session:) form=browser.form(:name,'userdata') = #Watir::Form:0x3859f08 located=false how=:name what=userdataselect_list=form.select_list(:name,'somename') = #Watir::SelectList:0x38546e8 located=false how=:name what=somenameselect_list.set('Yes') Watir::Exception::UnknownObjectException: Unable to locate element, using :name, somename from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ element.rb:58:in `assert_exists' from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ input_elements.rb:64:in `select_item_in_select_list' from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ input_elements.rb:48:in `set' from (irb):6puts select_list Watir::Exception::UnknownObjectException: Unable to locate element, using :name, somename from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ element.rb:58:in `assert_exists' from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ element.rb:195:in `to_s' from (irb):9:in `puts' from (irb):9as_htmlelement=browser.element(:name,'somename') = #Watir::HTMLElement:0x384e4f0 located=false how=:name what=somenameputs as_htmlelement type: Text id: name: somename value: Yes disabled: false = nilas_text=form.text_field(:name,'somename') = #Watir::TextField:0x3822c78 located=false how=:name what=somenameputs as_text Watir::Exception::UnknownObjectException: Unable to locate element, using :name, somename from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ element.rb:58:in `assert_exists' from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-1.8.1/lib/watir/ input_elements.rb:267:in `to_s' from (irb):11:in `puts' from
[wtr-general] type-ahead select lists
We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Here's the HTML: select dojoType=dijit.form.FilteringSelect id=advisor.dealerId name=advisor.dealerId style='width: 550px;' option value=0 /option option value=1059 1717 Capital Management / 300 Continental Drive / Suite 3 South / Newark, DE 19713-4329 / /option ...etc I thought I could use text_field to set a value here, just as if I typed it manually on the page. I tried ie.text_field(:id, 'advisor.dealerId').set(some value). When I do this in irb, I see it set the value, but when I submit, it shows the default value was selected instead. I also tried fire_event(onclick), that didn't help. We were able to get our Canoo WebTest scripts to select these with its forceHiddenInputField step. I thought maybe I could do something similar in Watir with input type=hidden, but I can't get the syntax right and I can't find any examples. I can't figure out where I would put input type=hidden in my text_field step. Would someone please point me to examples that might help me figure this out? I apologize if this is an ignorant question. I searched the mailing list and the Watir site but I could not figure out how to make this work. thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] type-ahead select lists
Hi Lisa, I don't know how you still have select as the input type if the dropdown is changed. Can you try this code? ie.select_list(:id, advisor.dealerId).select some value Thanks On Mon, May 23, 2011 at 2:44 PM, Lisa Crispin lisa.cris...@gmail.comwrote: We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Here's the HTML: select dojoType=dijit.form.FilteringSelect id=advisor.dealerId name=advisor.dealerId style='width: 550px;' option value=0 /option option value=1059 1717 Capital Management / 300 Continental Drive / Suite 3 South / Newark, DE 19713-4329 / /option ...etc I thought I could use text_field to set a value here, just as if I typed it manually on the page. I tried ie.text_field(:id, 'advisor.dealerId').set(some value). When I do this in irb, I see it set the value, but when I submit, it shows the default value was selected instead. I also tried fire_event(onclick), that didn't help. We were able to get our Canoo WebTest scripts to select these with its forceHiddenInputField step. I thought maybe I could do something similar in Watir with input type=hidden, but I can't get the syntax right and I can't find any examples. I can't figure out where I would put input type=hidden in my text_field step. Would someone please point me to examples that might help me figure this out? I apologize if this is an ignorant question. I searched the mailing list and the Watir site but I could not figure out how to make this work. thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- 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 -- Regards, Ashok Tulachan -- 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] The simplest Log
Hi guys I have basic tests than run with ant and log4j and I would like to have an output like this: test_modify_staff_phone: Ok test_modify_staff_phone: Failed nothing else. How could I achieve this? f(t) my test has assertions like: assert @browser.div(:class, z-window-modal).text_field(:name, phone_number_textbox).exist?, Cannot Find {Number} text-field. assert_equal phone_number, @browser.div(:class, z-window-modal).text_field(:name, phone_number_textbox).value.strip I am running ANT and Log4j with these properties: log4j.rootLogger=ERROR, LogFile log4j.logger.org.apache.tools.ant.Project=INFO log4j.logger.org.apache.tools.ant.Target=INFO log4j.logger.org.apache.tools.ant.taskdefs=INFO log4j.logger.org.apache.tools.ant.taskdefs.Echo=WARN log4j.appender.LogFile=org.apache.log4j.DailyRollingFileAppender log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout og4j.appender.LogFile.DatePattern='.'-MM-dd-HH log4j.appender.LogFile.layout.ConversionPattern=[%6r] %8c{1} : %m%n log4j.appender.LogFile.file=dev-monitor.log My Output Looks like this: [ 0] Project : Build started. [ 355] Target : Target test-filters started. [ 999] ExecTask : Loaded suite ../../hco-at/lib/dev_suite [ 1001] ExecTask : Started [ 55105] ExecTask : Launching Test for Filters in Incoming Faxes and Orders [ 55105] ExecTask : Testing Login and Typing Login Credentials [100046] ExecTask : .Launching Test for Modifying Phone Numbers [100047] ExecTask : Testing Login and Typing Login Credentials [120673] ExecTask : FLaunching Test for Sending A Fax [120673] ExecTask : Testing Login and Typing Login Credentials [121712] ExecTask : E [121712] ExecTask : Sending A Fax Test has concluded [121712] ExecTask : [121712] ExecTask : Finished in 120.715 seconds. [121713] ExecTask : [121713] ExecTask : 1) Failure: [121713] ExecTask : test_modify_staff_phone(ModifyPhone) [121714] ExecTask : [../../hco-at/lib/./dev/modify_phone.rb:147:in `validate_number_has_chaged' [121715] ExecTask : ../../hco-at/lib/./dev/modify_phone.rb:45:in `test_modify_staff_phone']: [121717] ExecTask : Could not find number {123-456-9878} which has been set to temporarily modify previous phone number {555-257-4109}. [121717] ExecTask : false is not true. [121718] ExecTask : [121718] ExecTask : 2) Error: [121719] ExecTask : test_send_a_fax(SendAFax): [121720] ExecTask : Watir::Exception::UnknownObjectException: unable to locate element, using {:tag_name=div, :text=Smith, Susan J 03/11/1909} [121721] ExecTask : C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.3/lib/watir-webdriver/elements/element.rb:241:in `assert_exists' [121722] ExecTask : C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.3/lib/watir-webdriver/elements/element.rb:69:in `click' [121723] ExecTask : ../../hco-at/lib/./dev/send_a_fax.rb:40:in `test_send_a_fax' [121723] ExecTask : [121727] ExecTask : 3 tests, 57 assertions, 1 failures, 1 errors -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] type-ahead select lists
On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com wrote: We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Is the page public? Or a similar page? Frameworks usually have examples somewhere online. If you think the only problem is that a JavaScript event is not fired (by Watir), take a look at this: http://stackoverflow.com/questions/3787555/how-to-find-out-which-javascript-events-fired If the site is not public, but you could show it to me, contact me off list. Ž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: type-ahead select lists
Hi Lisa, I think I found an example you're using here: http://www.upscale.utoronto.ca/test/dojo/tests/widget/test_Select.html I'm looking at Select #2 (dataUrl, autocomplete=true). The only way I could get it to work is by using send_keys: b = Watir::IE.attach(:title, /Dojo/) test_field = b.span(:class = dojoComboBoxOuter dj_ie, :index = 2).text_field(:class, dojoComboBox) test_field.focus b.send_keys(florida) sleep 2 b.send_keys({ENTER}) On May 23, 12:44 pm, Lisa Crispin lisa.cris...@gmail.com wrote: We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Here's the HTML: select dojoType=dijit.form.FilteringSelect id=advisor.dealerId name=advisor.dealerId style='width: 550px;' option value=0 /option option value=1059 1717 Capital Management / 300 Continental Drive / Suite 3 South / Newark, DE 19713-4329 / /option ...etc I thought I could use text_field to set a value here, just as if I typed it manually on the page. I tried ie.text_field(:id, 'advisor.dealerId').set(some value). When I do this in irb, I see it set the value, but when I submit, it shows the default value was selected instead. I also tried fire_event(onclick), that didn't help. We were able to get our Canoo WebTest scripts to select these with its forceHiddenInputField step. I thought maybe I could do something similar in Watir with input type=hidden, but I can't get the syntax right and I can't find any examples. I can't figure out where I would put input type=hidden in my text_field step. Would someone please point me to examples that might help me figure this out? I apologize if this is an ignorant question. I searched the mailing list and the Watir site but I could not figure out how to make this work. thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com @lisacrispin on Twitterhttp://entaggle.com/lisacrispin -- 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: The simplest Log
What kind of test framework are you using, test unit? I can run those in eclipse and the results are easy to ready. I'm sure there are edits that you can make to the test runner. https://lh3.googleusercontent.com/-9xbdw7FKGKo/Tdrawu1GzQI/Etc/Gv9n3HVFvI4/TestUnit.JPG Dave -- 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] No HTML returned from an iFrame in webdriver and Firefox4
Good Afternoon! Moving to Firefox 4 and webdriver and noticed a difference I can't seem to get past from FF3.6 and Watir - I can't seem to acces the HTML from an iFrame. # On two different Windows XP images, Ruby version 1.9.2 # Test to get version number of windows Safari testpage = http://www.apple.com/safari/download/; # In FF3.6 and Watir 1.8.1 require 'rubygems' require 'watir' ff = FireWatir::Firefox.new ff.goto testpage ff.frame(:name, 'myframe').html.include? 5.0.5' = true! Just what I wanted to see. - # FF4 Webdriver 0.2.3 require 'rubygems' require 'watir-webdriver' ff = Watir::Browser.new(:firefox) ff.goto testpage ff.iframe(:name = 'myframe').html.include? 5.0.5 = false! I know we should be finding the version number, so something is up. If I just ask for the HTML, I get the iFrame tag - Not the html that it returns. Only the iFrame is Returned: iframe src=https://swdlp.apple.com/cgi-bin/WebObjects/ SoftwareDownloadApp.woa/wa/getProductData? localang=en_us#38;grp_code=safari#38;returnURL=http://www.apple.com/ safari/download#38;isMiniiFrameReq=N title=Please select a download. name=myframe frameborder=0 allowtransparency=true scrolling=no id=download-frame style=height: 660pxYour browser is not compatible with this content; please upgrade to a standards- based browser./iframe When I used FF3.6 and Watir, I got the HTML inside the iFrame, (most html omitted for brevity) Returned: iframe htmlheadbodydiv id= ... {Version number a few levels down} ... /div/body/head/html /iframe Am I missing something here? The iFrame is on the same domain, apple.com, and looking at the webdriver api for [Class: Watir::IFrame], I can't seem to find anything that might work. Help would be greatly appreciated, thank you! Quick note, I used ff.iframe instead of ff.frame in the webdriver version because ff.frame returned an error, [Selenium::WebDriver::Error::UnexpectedJavascriptError: Could not convert Javascript argument arg 0]. ff.iFrame seemed to work so I began to use that. -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: The simplest Log
Exactly, I also can run it from Netbeans in my case and they I can read them fine. The problem is that my boss is asking for a cleaner result log. f(t) On 5/23/11, Dave McNulla mcnu...@gmail.com wrote: What kind of test framework are you using, test unit? I can run those in eclipse and the results are easy to ready. I'm sure there are edits that you can make to the test runner. https://lh3.googleusercontent.com/-9xbdw7FKGKo/Tdrawu1GzQI/Etc/Gv9n3HVFvI4/TestUnit.JPG Dave -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] type-ahead select lists
That's what I had when this was just a regular select list, it doesn't work anymore now that we have this dojo stuff. -- Lisa On Mon, May 23, 2011 at 1:59 PM, Ashok Tulachan tulachanas...@gmail.comwrote: Hi Lisa, I don't know how you still have select as the input type if the dropdown is changed. Can you try this code? ie.select_list(:id, advisor.dealerId).select some value Thanks On Mon, May 23, 2011 at 2:44 PM, Lisa Crispin lisa.cris...@gmail.comwrote: We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Here's the HTML: select dojoType=dijit.form.FilteringSelect id=advisor.dealerId name=advisor.dealerId style='width: 550px;' option value=0 /option option value=1059 1717 Capital Management / 300 Continental Drive / Suite 3 South / Newark, DE 19713-4329 / /option ...etc I thought I could use text_field to set a value here, just as if I typed it manually on the page. I tried ie.text_field(:id, 'advisor.dealerId').set(some value). When I do this in irb, I see it set the value, but when I submit, it shows the default value was selected instead. I also tried fire_event(onclick), that didn't help. We were able to get our Canoo WebTest scripts to select these with its forceHiddenInputField step. I thought maybe I could do something similar in Watir with input type=hidden, but I can't get the syntax right and I can't find any examples. I can't figure out where I would put input type=hidden in my text_field step. Would someone please point me to examples that might help me figure this out? I apologize if this is an ignorant question. I searched the mailing list and the Watir site but I could not figure out how to make this work. thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- 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 -- Regards, Ashok Tulachan -- 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 -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] Re: type-ahead select lists
Wow, I never even heard of send_keys, I'll give it a try, thank you. -- Lisa On Mon, May 23, 2011 at 3:26 PM, George george.sand...@gmail.com wrote: Hi Lisa, I think I found an example you're using here: http://www.upscale.utoronto.ca/test/dojo/tests/widget/test_Select.html I'm looking at Select #2 (dataUrl, autocomplete=true). The only way I could get it to work is by using send_keys: b = Watir::IE.attach(:title, /Dojo/) test_field = b.span(:class = dojoComboBoxOuter dj_ie, :index = 2).text_field(:class, dojoComboBox) test_field.focus b.send_keys(florida) sleep 2 b.send_keys({ENTER}) On May 23, 12:44 pm, Lisa Crispin lisa.cris...@gmail.com wrote: We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Here's the HTML: select dojoType=dijit.form.FilteringSelect id=advisor.dealerId name=advisor.dealerId style='width: 550px;' option value=0 /option option value=1059 1717 Capital Management / 300 Continental Drive / Suite 3 South / Newark, DE 19713-4329 / /option ...etc I thought I could use text_field to set a value here, just as if I typed it manually on the page. I tried ie.text_field(:id, 'advisor.dealerId').set(some value). When I do this in irb, I see it set the value, but when I submit, it shows the default value was selected instead. I also tried fire_event(onclick), that didn't help. We were able to get our Canoo WebTest scripts to select these with its forceHiddenInputField step. I thought maybe I could do something similar in Watir with input type=hidden, but I can't get the syntax right and I can't find any examples. I can't figure out where I would put input type=hidden in my text_field step. Would someone please point me to examples that might help me figure this out? I apologize if this is an ignorant question. I searched the mailing list and the Watir site but I could not figure out how to make this work. thanks, Lisa -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009)http://lisacrispin.com @lisacrispin on Twitterhttp://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.comhttp://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
Re: [wtr-general] type-ahead select lists
The pages where we're using this aren't public. But I will look at this link, thanks! -- Lisa On Mon, May 23, 2011 at 2:36 PM, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Mon, May 23, 2011 at 9:44 PM, Lisa Crispin lisa.cris...@gmail.com wrote: We are changing what used to be regular drop-down select list boxes to a dojo widget thingie that allows type ahead to select the item. Is the page public? Or a similar page? Frameworks usually have examples somewhere online. If you think the only problem is that a JavaScript event is not fired (by Watir), take a look at this: http://stackoverflow.com/questions/3787555/how-to-find-out-which-javascript-events-fired If the site is not public, but you could show it to me, contact me off list. Ž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 -- Lisa Crispin Co-author with Janet Gregory, _Agile Testing: A Practical Guide for Testers and Agile Teams_ (Addison-Wesley 2009) Contributor to _Beautiful Testing_ (O'Reilly 2009) http://lisacrispin.com @lisacrispin on Twitter http://entaggle.com/lisacrispin -- 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