Forum: Ruby Watir question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Cc704ce316e72af824ccd38cfa53104b?d=identicon&s=25 Raja Gopalan (arc)
on 2014-07-21 10:36
hi,

<iframe name="mce_editor_0" width="502" height="78"
class="mceEditorIframe" id="mce_editor_0"
src="/idit-web/web-framework/script/tinymce/blank.htm" border="0"
frameBorder="0" marginWidth="0" marginHeight="0" style="width: 502px;
height: 78px;" allowTransparency="allowtransparency" leftMargin="0"
topMargin="0">


The above HTML code appears as a text box in my webpage, but If I use
$browser.iframe(:id,'aaa').set() it says that set is undefined method in
that, ofcourse it's right. That being said,Can you anyone please tell me
how do I access that text box to write.?
14b5582046b4e7b24ab69b7886a35868?d=identicon&s=25 Joel Pearson (virtuoso)
on 2014-07-21 21:05
If you want to overwrite HTML in Watir, you'll need to use
Browser#execute_script and write some custom JavaScript.
Cc704ce316e72af824ccd38cfa53104b?d=identicon&s=25 Raja Gopalan (arc)
on 2014-07-21 21:07
hi, I don't exactly understand, can you give me some example?
14b5582046b4e7b24ab69b7886a35868?d=identicon&s=25 Joel Pearson (virtuoso)
on 2014-07-21 23:36
I mean you're moving from a Ruby code environment into a JavaScript code
environment:
driver.execute_script "javascript code here;"

Since your iframe has a "src" attribute, you should edit that source if
you want to alter the content. I think there's a way to do that in
JavaScript, but you'll probably have to disassociate that document from
the source before you can edit it.

I'm not fluent enough in JavaScript to go into any further detail, but
I'm sure there are tips available if you Google "Javascript edit iframe
html" or something similar.
Cc704ce316e72af824ccd38cfa53104b?d=identicon&s=25 Raja Gopalan (arc)
on 2014-07-22 05:45
OK Thank you.
This topic is locked and can not be replied to.