Reputation: 247
I am new to ruby and watir-webdriver. I am trying to learn how to test tinymce from the website http://www.tinymce.com/tryit/full.php. I can click the buttons such as "Bold" but I cannot figure out if there is a way to select/highlight text in the textarea to test the "Bold" button. I can find the text "Feel free" in the textarea but I am not sure how to select the text. I have noticed that the other posts mention that Tinymce is in frames but it does not appeart to be in a frame on the current page.
Here is what the section looks like (edited form)
<textarea id="content" style="width: 100%; height: 550px; display: none;" name="content" cols="20" rows="20" aria-hidden="true">
<p>Feel free to try out the different features ...</p>
</textarea>
require 'watir-webdriver'
b = Watir::Browser.new :firefox
b.goto "http://www.tinymce.com/tryit/full.php"
b.div(:id => 'main').wait_until_present
b.textarea(:value => /Feel free/).exists? #this evaluates to "true"
Where I need to select the text
b.a(:title => 'Bold (Ctrl+B)').hover
b.a(:title => 'Bold (Ctrl+B)').click
Upvotes: 3
Views: 312
Reputation: 57262
Yes, the editor is in a frame. This selects to
from Welcome to the TinyMCE editor demo!
:
require "watir-webdriver"
browser = Watir::Browser.new :firefox
browser.goto "http://www.tinymce.com/tryit/full.php"
require "watir-webdriver/extensions/select_text"
browser.frame(id:"content_ifr").h1.select_text "to"
Upvotes: 3