[wtr-general] Re: automate text in Frames Watir with HTML Document
Hello Chuck When i comment the line with the script, then send_keys is the problem, the thing is i am setting the same to test the CKEditor page, and it works ok. I think the problem is the way i am assigning the frame, code: @browser.frame(:title = 'Rich text editor, ckeditor1, press ALT 0 for help.').send_keys(hello world again) error: unable to locate frame/iframe using {:title=Rich text editor, ckeditor1, press ALT 0 for help.} (Watir::Exception::UnknownFrameException) What I can tell you is that my Frames are inside a Form, and in every frame i have my CKEditor (one in each frame). Thank you, if you need some aditional information just let me know. On 7 dic, 14:30, Chuck van der Linden sqa...@gmail.com wrote: What line of your code is causing the error? is it the execute_script one, or the sendkeys? if it's the first one, have you tried just using the second? There's a lot of potential problems that could cause this, including different javascript or method names depending on what version your devs are using vs what you were able to automate against on a sample site, and the various options that may be enabled for your editor (those things are highly configurable) If sendkeys works you may have to see if there is some way (either via a button, or keystrokes) to do a select all followed by delete (presuming there is content in the window to start with) and use sendkeys to send the content you need to the window. a bit brute force but could potentially work. On Dec 6, 7:59 pm, Erna Tercero erna.terc...@gmail.com wrote: Ok I am back :( I found some interesting post in the WEB and i got into this: @browser.execute_script(CKeditor1.instances.'CKeditor1'.setData('hello world');) @browser.frame(:title, Rich text editor, CKeditor1, press ALT 0 for help.).send_keys hello world again Taken of a post about autamating CKEditor demo page, i can automate the page with no problem, so, when i try to implement something similar into my page is kind of complicated, in chrome i get this error: Timeout::Error (Timeout::Error) C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill' C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill' C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' C:/Ruby/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line' C:/Ruby/lib/ruby/1.9.1/net/http.rb:2551:in `read_new' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1316:in `catch' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1293:in `request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1286:in `block in request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:745:in `start' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1284:in `request' in FF and IExplore i get this error: unknown error (Selenium::WebDriver::Error::UnexpectedJavascriptError) so i do not know much about java script, so, can you help me to see if i am implementing this right? this is my code: body onpageshow=null;event.persisted CKEDITOR.tools.callFunction(0) textarea id=CKEditor1 name=CKEditor1 style=visibility: hidden; display: none;/textarea span id=cke_CKEditor1 class=cke_skin_kama cke_editor_CKEditor1 lang=en aria-labelledby=cke_CKEditor1_arialbl role=application title= dir=ltr onmousedown=return false; script type=text/javascript /body if you nedd a little more information let me know. Thank you for your attention and your time :D On 5 dic, 21:52, Erna Tercero erna.terc...@gmail.com wrote: Thank you a lot, i will be playing for a little with this component to see its behaivor, maybe i can set a string variable and send to it a html code, let you know the results. Thank you so much for your time. i'll keep in touch... :D On 5 dic, 15:40, Chuck van der Linden sqa...@gmail.com wrote: Is this an example of the editor you are using? http://ckeditor.com/demo If so you may need to deal with it by mostly using sendkeys to send keystrokes to a given instance of H1 or P tag inside the main body.. Since this is a third party tool, you may also ask yourself how much value you provide to your employer by testing code supplied by a third party instead of focusing on other areas of the application If your editor control has the 'source' button enabled that might make it easier to deal with by clicking the span that contains that text (it's not a button element, it just looks like one due to (I think) a background image defined for the span) on the demo page, switching to 'source' mode replaces the wysiwyg editor with a text area control that shows the actual HTML that was in the editor, which might be a lot easier to set the contents of, then switch back. (a valid way to skin
[wtr-general] Re: automate text in Frames Watir with HTML Document
Ok I am back :( I found some interesting post in the WEB and i got into this: @browser.execute_script(CKeditor1.instances.'CKeditor1'.setData('hello world');) @browser.frame(:title, Rich text editor, CKeditor1, press ALT 0 for help.).send_keys hello world again Taken of a post about autamating CKEditor demo page, i can automate the page with no problem, so, when i try to implement something similar into my page is kind of complicated, in chrome i get this error: Timeout::Error (Timeout::Error) C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill' C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill' C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil' C:/Ruby/lib/ruby/1.9.1/net/protocol.rb:132:in `readline' C:/Ruby/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line' C:/Ruby/lib/ruby/1.9.1/net/http.rb:2551:in `read_new' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1316:in `catch' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1293:in `request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1286:in `block in request' C:/Ruby/lib/ruby/1.9.1/net/http.rb:745:in `start' C:/Ruby/lib/ruby/1.9.1/net/http.rb:1284:in `request' in FF and IExplore i get this error: unknown error (Selenium::WebDriver::Error::UnexpectedJavascriptError) so i do not know much about java script, so, can you help me to see if i am implementing this right? this is my code: body onpageshow=null;event.persisted CKEDITOR.tools.callFunction(0) textarea id=CKEditor1 name=CKEditor1 style=visibility: hidden; display: none;/textarea span id=cke_CKEditor1 class=cke_skin_kama cke_editor_CKEditor1 lang=en aria-labelledby=cke_CKEditor1_arialbl role=application title= dir=ltronmousedown=return false; script type=text/javascript /body if you nedd a little more information let me know. Thank you for your attention and your time :D On 5 dic, 21:52, Erna Tercero erna.terc...@gmail.com wrote: Thank you a lot, i will be playing for a little with this component to see its behaivor, maybe i can set a string variable and send to it a html code, let you know the results. Thank you so much for your time. i'll keep in touch... :D On 5 dic, 15:40, Chuck van der Linden sqa...@gmail.com wrote: Is this an example of the editor you are using? http://ckeditor.com/demo If so you may need to deal with it by mostly using sendkeys to send keystrokes to a given instance of H1 or P tag inside the main body.. Since this is a third party tool, you may also ask yourself how much value you provide to your employer by testing code supplied by a third party instead of focusing on other areas of the application If your editor control has the 'source' button enabled that might make it easier to deal with by clicking the span that contains that text (it's not a button element, it just looks like one due to (I think) a background image defined for the span) on the demo page, switching to 'source' mode replaces the wysiwyg editor with a text area control that shows the actual HTML that was in the editor, which might be a lot easier to set the contents of, then switch back. (a valid way to skin this cat since we presume the purpose here is to use the editor to inject some known content into your system, not test the actual editor ) On Dec 5, 7:01 am, Erna Tercero erna.terc...@gmail.com wrote: The code in the iframe looks like this: iframe id=englishDescEditor width=100% height=450 style=border: none; src=/html/js/editor/editor.jsp? p_l_id=10152p_main_path=%2Fen%2FcdoAsUserId=fYEBeUwab1o %3DeditorImpl=ckeditorinitMethod=getEnglishTextcssPath=%2Fhtml %2Fthemes%2Fcontrol_panel%2FcsscssClasses=portlet+ name=englishDescEditor html head body onpageshow=null;event.persisted CKEDITOR.tools.callFunction(0) textarea id=CKEditor1 name=CKEditor1 style=visibility: hidden; display: none;/textarea span id=cke_CKEditor1 class=cke_skin_kama cke_editor_CKEditor1 lang=en aria-labelledby=cke_CKEditor1_arialbl role=application title= dir=ltr onmousedown=return false; span id=cke_CKEditor1_arialbl class=cke_voice_labelRich Text Editor/span span class=cke_browser_gecko cke_browser_quirks role=presentation span class=cke_wrapper cke_ltr role=presentation table class=cke_editor cellspacing=0 cellpadding=0 border=0 role=presentation tbody tr style=-moz-user-select: none; tr td id=cke_contents_CKEditor1 class=cke_contents role=presentation style=height:265px iframe frameborder=0 allowtransparency=true tabindex=0 src=javascript:void(function(){document.open()%3Bdocument.close()%3B} ()) style=width:100%;height:100% html dir=ltr /iframe /td /tr tr style=-moz-user-select: none; /tbody /table style /span /span /span script type=text/javascript /body /html
[wtr-general] Re: automate text in Frames Watir with HTML Document
The code in the iframe looks like this: iframe id=englishDescEditor width=100% height=450 style=border: none; src=/html/js/editor/editor.jsp? p_l_id=10152p_main_path=%2Fen%2FcdoAsUserId=fYEBeUwab1o %3DeditorImpl=ckeditorinitMethod=getEnglishTextcssPath=%2Fhtml %2Fthemes%2Fcontrol_panel%2FcsscssClasses=portlet+ name=englishDescEditor html head body onpageshow=null;event.persisted CKEDITOR.tools.callFunction(0) textarea id=CKEditor1 name=CKEditor1 style=visibility: hidden; display: none;/textarea span id=cke_CKEditor1 class=cke_skin_kama cke_editor_CKEditor1 lang=en aria-labelledby=cke_CKEditor1_arialbl role=application title= dir=ltr onmousedown=return false; span id=cke_CKEditor1_arialbl class=cke_voice_labelRich Text Editor/span span class=cke_browser_gecko cke_browser_quirks role=presentation span class=cke_wrapper cke_ltr role=presentation table class=cke_editor cellspacing=0 cellpadding=0 border=0 role=presentation tbody tr style=-moz-user-select: none; tr td id=cke_contents_CKEditor1 class=cke_contents role=presentation style=height:265px iframe frameborder=0 allowtransparency=true tabindex=0 src=javascript:void(function(){document.open()%3Bdocument.close()%3B} ()) style=width:100%;height:100% html dir=ltr /iframe /td /tr tr style=-moz-user-select: none; /tbody /table style /span /span /span script type=text/javascript /body /html /iframe *** on the html dir=ltr code it is in this way: html dir=ltr head body class=cke_show_borders spellcheck=false p br type=_moz /p /body /html *** Manually, the text is save in the paragraph p br type=_moz /p Thank you!!! On 5 dic, 06:08, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Sun, Dec 4, 2011 at 8:10 AM, Erna Tercero erna.terc...@gmail.com wrote: I have this element on a frame: HTML Document name= id= src=javascript:void(function(){document.open() %3Bparent.CKEDITOR.tools.callFunction(72%2Cdocument)%3Bdocument.close() %3B}()) And the element is? Text field? Željko -- watir.com/book - author -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: automate text in Frames Watir with HTML Document
Thank you a lot, i will be playing for a little with this component to see its behaivor, maybe i can set a string variable and send to it a html code, let you know the results. Thank you so much for your time. i'll keep in touch... :D On 5 dic, 15:40, Chuck van der Linden sqa...@gmail.com wrote: Is this an example of the editor you are using? http://ckeditor.com/demo If so you may need to deal with it by mostly using sendkeys to send keystrokes to a given instance of H1 or P tag inside the main body.. Since this is a third party tool, you may also ask yourself how much value you provide to your employer by testing code supplied by a third party instead of focusing on other areas of the application If your editor control has the 'source' button enabled that might make it easier to deal with by clicking the span that contains that text (it's not a button element, it just looks like one due to (I think) a background image defined for the span) on the demo page, switching to 'source' mode replaces the wysiwyg editor with a text area control that shows the actual HTML that was in the editor, which might be a lot easier to set the contents of, then switch back. (a valid way to skin this cat since we presume the purpose here is to use the editor to inject some known content into your system, not test the actual editor ) On Dec 5, 7:01 am, Erna Tercero erna.terc...@gmail.com wrote: The code in the iframe looks like this: iframe id=englishDescEditor width=100% height=450 style=border: none; src=/html/js/editor/editor.jsp? p_l_id=10152p_main_path=%2Fen%2FcdoAsUserId=fYEBeUwab1o %3DeditorImpl=ckeditorinitMethod=getEnglishTextcssPath=%2Fhtml %2Fthemes%2Fcontrol_panel%2FcsscssClasses=portlet+ name=englishDescEditor html head body onpageshow=null;event.persisted CKEDITOR.tools.callFunction(0) textarea id=CKEditor1 name=CKEditor1 style=visibility: hidden; display: none;/textarea span id=cke_CKEditor1 class=cke_skin_kama cke_editor_CKEditor1 lang=en aria-labelledby=cke_CKEditor1_arialbl role=application title= dir=ltr onmousedown=return false; span id=cke_CKEditor1_arialbl class=cke_voice_labelRich Text Editor/span span class=cke_browser_gecko cke_browser_quirks role=presentation span class=cke_wrapper cke_ltr role=presentation table class=cke_editor cellspacing=0 cellpadding=0 border=0 role=presentation tbody tr style=-moz-user-select: none; tr td id=cke_contents_CKEditor1 class=cke_contents role=presentation style=height:265px iframe frameborder=0 allowtransparency=true tabindex=0 src=javascript:void(function(){document.open()%3Bdocument.close()%3B} ()) style=width:100%;height:100% html dir=ltr /iframe /td /tr tr style=-moz-user-select: none; /tbody /table style /span /span /span script type=text/javascript /body /html /iframe *** on the html dir=ltr code it is in this way: html dir=ltr head body class=cke_show_borders spellcheck=false p br type=_moz /p /body /html *** Manually, the text is save in the paragraph p br type=_moz /p Thank you!!! On 5 dic, 06:08, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Sun, Dec 4, 2011 at 8:10 AM, Erna Tercero erna.terc...@gmail.com wrote: I have this element on a frame: HTML Document name= id= src=javascript:void(function(){document.open() %3Bparent.CKEDITOR.tools.callFunction(72%2Cdocument)%3Bdocument.close() %3B}()) And the element is? Text field? Željko -- watir.com/book - author- Ocultar texto de la cita - - Mostrar texto de la cita - -- 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: Problem when set require 'Watir-WebDriver'in .rb file
Hi Chuck. I am happy working with FF and even Chrome, follow the instructions in https://github.com/zeljkofilipin/watirbook/blob/master/installation/windows.md if it is necesary, uninstall all gems and start from the begin, it is worthy the effort. I have to low the versions of IE(8) and FF(6) to work on it fine, and do not change much environment config (I am just a newby) So hope this works with you. Regards -- 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: Problem when set require 'Watir-WebDriver'in .rb file
Hello Zeljko I just finishing installing what i need, i found this link, explaining step by step, yes, i had to install the devkiy to run Webdriver, and now i will begin to initiate my scripts hope do not have to post in the mean time. http://www.haslo.ch/blog/actually-installing-ruby-on-rails-on-windows-7/#comment-1634 The problem it is with ruby and windows7 64bit Thanks for the help. On 25 nov, 13:56, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Fri, Nov 25, 2011 at 8:14 PM, Erna Tercero erna.terc...@gmail.com wrote: gem install watir ERROR: Error installing watir: Why are you installing watir? All you had to do is uninstall the most recent version of ffi gem, and install version 1.0.9. If you are having problems with rubyinstaller, please post to their support group. Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Re: Problem when set require 'Watir-WebDriver'in .rb file
This other link was helpful too: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit Ciao!! On 26 nov, 07:52, Erna Tercero erna.terc...@gmail.com wrote: Hello Zeljko I just finishing installing what i need, i found this link, explaining step by step, yes, i had to install the devkiy to run Webdriver, and now i will begin to initiate my scripts hope do not have to post in the mean time. http://www.haslo.ch/blog/actually-installing-ruby-on-rails-on-windows... The problem it is with ruby and windows7 64bit Thanks for the help. On 25 nov, 13:56, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Fri, Nov 25, 2011 at 8:14 PM, Erna Tercero erna.terc...@gmail.com wrote: gem install watir ERROR: Error installing watir: Why are you installing watir? All you had to do is uninstall the most recent version of ffi gem, and install version 1.0.9. If you are having problems with rubyinstaller, please post to their support group. Željko -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com
[wtr-general] Problem when set require 'Watir-WebDriver'in .rb file
i am trying to do som automate testing, my code says: require ‘watir’ b = Watir::Browser.new b.goto ‘www.google.com’ b.text_field(:name = ‘q’).set ‘Watir-WebDriver’ b.button(:name = ‘btnG’).click b.div(:id = ‘resultStats’).wait_until_present puts “Displaying page: ‘#{b.title}’ with results: ‘#{b.div(:id = “resultStats”).text}’” b.close ***Runs Ok ***When I want to specify the browser with this code, send me a lot of errors: require ‘watir-webdriver’ b = Watir::Browser.new :firefox b.goto ‘www.google.com’ b.text_field(:name = ‘q’).set ‘Watir-WebDriver’ b.button(:name = ‘btnG’).click b.div(:id = ‘resultStats’).wait_until_present puts “Displaying page: ‘#{b.title}’ with results: ‘#{b.div(:id = “resultStats”).text}’” b.close *** I receive this errors cannot load such file — ffi_c (LoadError) C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’ C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require’ ***when i add the Selenium require: require ‘watir-webdriver’ require ‘Selenium’ b = Watir::Browser.new :firefox b.goto ‘www.google.com’ b.text_field(:name = ‘q’).set ‘Watir-WebDriver’ b.button(:name = ‘btnG’).click b.div(:id = ‘resultStats’).wait_until_present puts “Displaying page: ‘#{b.title}’ with results: ‘#{b.div(:id = “resultStats”).text}’” b.close ***and got this errors: C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require’: iconv will be deprecated in the future, use String#encode instead. cannot load such file — Selenium (LoadError) C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require’ C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require’ D:/New folder/Projects/MBAM-TC/features/First_Visit.rb:4:in `’ C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.1.3/lib/cucumber/rb_support/rb_la nguage.rb:129:in `load’ *** i have install all the gems, and i am working on windows 7, with ruby v 1.9.3p0 -- 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: Problem when set require 'Watir-WebDriver'in .rb file
Thank you but it does not work. i uninstall again and now the error is this: gem install watir ERROR: Error installing watir: The 'ffi' native gem requires installed build tools. Please update your PATH to include build tools or download the DevKit from 'http://rubyinstaller.org/downloads' and follow the instructions at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit' and i installed the dev kit but gave me more problems ;( can you give me some help? On 25 nov, 05:03, Željko Filipin zeljko.fili...@wa-research.ch wrote: On Fri, Nov 25, 2011 at 3:47 AM, Erna Tercero erna.terc...@gmail.com wrote: cannot load such file — ffi_c (LoadError) This will solve the problem: http://stackoverflow.com/questions/7964778/no-such-file-to-load-ffi-c... Željko -- watir.com/book - author -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. watir-general@googlegroups.com http://groups.google.com/group/watir-general watir-general+unsubscr...@googlegroups.com