{"id":101,"date":"2007-09-04T11:13:40","date_gmt":"2007-09-04T11:13:40","guid":{"rendered":"http:\/\/quinert.com\/blog\/xml-rss2.php?itemid=49"},"modified":"2007-09-04T11:13:40","modified_gmt":"2007-09-04T11:13:40","slug":"watir-difficulties-problems-and-trouble-with-tinymce","status":"publish","type":"post","link":"http:\/\/www.software-testing.com.au\/blog\/2007\/09\/04\/watir-difficulties-problems-and-trouble-with-tinymce\/","title":{"rendered":"Watir difficulties, problems and trouble with TinyMCE"},"content":{"rendered":"<p>I&#8217;ve spent far too much of the last day and a bit trying to get Watir to identify and manipulate the <a href=\"http:\/\/tinymce.moxiecode.com\/example_full.php\">TinyMCE<\/a> rich text edit control.  Hopefully the title of this post will allow anyone experiencing <a href=\"http:\/\/www.mail-archive.com\/wtr-general@rubyforge.org\/msg09231.html\">similar problems<\/a> to Google my solution!<\/p>\n<p>TinyMCE does a lot of javascript nastiness (from Watir&#8217;s perspective), turning a text area HTML tag into a funky iframe WYSIWYG text editor.  Watir seems to have trouble doing much with it, but I was finally able to get an acceptable (for now) solution:<\/p>\n<p><code><br \/>\n#Substitute your TinyMCE editor instance for 'mce_editor_0'.  It will probably usually be OK though.<\/p>\n<p>$ie.ie.Document.parentWindow.execScript(\"tf=document.<br \/>\n  getElementById(\\\"mce_editor_0\\\");tf.contentWindow.focus()\") <br \/>\n$ie.send_keys(\"Hello there\")<br \/>\n<\/code><\/p>\n<p>It&#8217;s not nice, but it sure beats yesterday&#8217;s solution:<br \/>\n<code><br \/>\n20.times{$ie.send_keys(\"{TAB}\")}<br \/>\n$ie.send_keys(\"Hello there\")<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent far too much of the last day and a bit trying to get Watir to identify and manipulate the TinyMCE rich text edit control. Hopefully the title of this post will allow anyone experiencing similar problems to Google my solution! TinyMCE does a lot of javascript nastiness (from Watir&#8217;s perspective), turning a text [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,34,41],"tags":[],"class_list":["post-101","post","type-post","status-publish","format-standard","hentry","category-software-testing","category-test-automation","category-watir"],"_links":{"self":[{"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/posts\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/comments?post=101"}],"version-history":[{"count":0,"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.software-testing.com.au\/blog\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}