3

ruby と watir-webdriver は初めてです。ウェブサイトhttp://www.tinymce.com/tryit/full.phpから tinymce をテストする方法を学ぼうとしています。「太字」などのボタンをクリックすることはできますが、テキストエリア内のテキストを選択/強調表示して「太字」ボタンをテストする方法があるかどうかわかりません。テキストエリアに「Feel free」というテキストがありますが、テキストの選択方法がわかりません。Tinymce がフレーム内にあると他の投稿で言及されていることに気付きましたが、現在のページのフレーム内にはないようです。

これがセクションの外観です(編集されたフォーム)

<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
4

1 に答える 1

3

はい、エディターはフレーム内にあります。以下から選択toWelcome 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"
于 2012-12-07T20:59:05.763 に答える