gpt4 book ai didi

Tinymce 选择文本

转载 作者:行者123 更新时间:2023-12-01 14:19:17 25 4
gpt4 key购买 nike

我是 ruby​​ 和 watir-webdriver 的新手。我正在尝试从网站上学习如何测试 tinymce http://www.tinymce.com/tryit/full.php .我可以单击诸如“粗体”之类的按钮,但我不知道是否可以选择/突出显示文本区域中的文本来测试“粗体”按钮。我可以在文本区域中找到文本“随意”,但我不确定如何选择文本。我注意到其他帖子提到 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

最佳答案

是的,编辑器在一个框架中。这从 Welcome to the TinyMCE editor demo! 中选择 to:

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"

关于Tinymce 选择文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13768767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com