Note that there are some explanatory texts on larger screens.

plurals
  1. POwebdriver tinymce content_formatselect
    primarykey
    data
    text
    <p>I am trying to create a test case that selects some text in tinymce and than changes the style from paragraph to a heading. I have some code that almost works but it has to be run twice for it function. The following is an excerpt from the code that steps through each button on the first row of the toolbar menu. I am wondering why I need to run it twice. I can see the dropdown menu dropdown during the first hover and click but the format is not changed unless I run the code the second time.</p> <pre><code>b.frame(id:"content_ifr").p.select_text "to try" b.table(:id =&gt; 'content_formatselect').hover b.table(:id =&gt; 'content_formatselect').click b.span(:title =&gt; 'Heading 1').hover b.span(:title =&gt; 'Heading 1').click #second time b.table(:id =&gt; 'content_formatselect').hover b.table(:id =&gt; 'content_formatselect').click b.span(:title =&gt; 'Heading 1').hover b.span(:title =&gt; 'Heading 1').click </code></pre> <p>The test is from the <a href="http://www.tinymce.com/tryit/full.php" rel="nofollow">http://www.tinymce.com/tryit/full.php</a> page. Here is more of the code it is fairly basic at this point but it does work. I did change the span to an a tag but that did not affect the outcome.</p> <pre><code>require 'watir-webdriver' require 'watir-webdriver/extensions/select_text' #require 'test/unit' b = Watir::Browser.new :firefox b.goto "http://www.tinymce.com/tryit/full.php" b.div(:id =&gt; 'main').wait_until_present bodyy = b.textarea(:name =&gt; 'content').value b.textarea(:value =&gt; /Feel free/).exists? b.frame(id:"content_ifr").p.select_text "Feel free" b.a(:title =&gt; 'Bold (Ctrl+B)').hover b.a(:title =&gt; 'Bold (Ctrl+B)').click b.a(:title =&gt; 'Italic (Ctrl+I)').hover b.a(:title =&gt; 'Italic (Ctrl+I)').click b.a(:title =&gt; 'Underline (Ctrl+U)').hover b.a(:title =&gt; 'Underline (Ctrl+U)').click b.a(:title =&gt; 'Strikethrough').hover b.a(:title =&gt; 'Strikethrough').click b.a(:title =&gt; 'Align Left').hover b.a(:title =&gt; 'Align Left').click b.a(:title =&gt; 'Align Center').hover b.a(:title =&gt; 'Align Center').click b.a(:title =&gt; 'Align Right').hover b.a(:title =&gt; 'Align Right').click b.a(:title =&gt; 'Align Full').hover b.a(:title =&gt; 'Align Full').click b.table(:id =&gt; 'content_styleselect').hover b.table(:id =&gt; 'content_styleselect').click b.a(:text =&gt; 'example2').hover b.a(:text =&gt; 'example2').click b.table(:id =&gt; 'content_styleselect').hover b.table(:id =&gt; 'content_styleselect').click b.a(:text =&gt; 'example1').hover b.a(:text =&gt; 'example1').click b.table(:id =&gt; 'content_styleselect').hover b.table(:id =&gt; 'content_styleselect').click b.a(:text =&gt; 'tablerow1').hover b.a(:text =&gt; 'tablerow1').click </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload