我正在尝试使用 selenium2library 关键字(在 Plone 中)选择 TinyMCE 字段的文本。
我尝试使用鼠标事件(鼠标向下/向上/向上)、Javascript 和“双击元素”选择文本,但到目前为止没有任何效果。如果我设置调试器并手动选择文本,则以下代码有效:
Go to ${PLONE_URL}/++add++Document
Input Text name=form.widgets.IDublinCore.title My Document
Select frame id=form.widgets.text_ifr
Input text id=content Lorem Ipsum
# Attempt with Javascript
Execute Javascript document.getElementById("content").select()
# Attempt with Double Click
Double Click Element xpath=//body[@id='content']/p[1]
Double Click Element id=content
# Attempt with Mouse Events
Mouse Down xpath=//body[@id='content']/p[contains(text(),'L')]
Mouse Over xpath=//body[@id='content']/p[contains(text(),'orem')]
Mouse Up xpath=//body[@id='content']/p[contains(text(),'Ipsum')]
# When I set a debug statement here and select the text manually the test passes
Unselect Frame
Click Link id=form.widgets.text_link
Wait until page contains element id=mce_31_ifr
Select frame id=mce_31_ifr
Click Link News
...
如果有人可以推荐哪种方法最有前途,那已经很有帮助了。