【发布时间】:2018-05-29 14:05:07
【问题描述】:
F1,需要一些关于 隐藏元素 使用 Robotframework 的帮助或提示。
问题在于要填充文本区域中的任何文本,我需要将文本区域的状态从 display:none; to display:block; 更改为
Code that I see from WebDev Tool
代码本身:
<div class="col-md-12">
<div class="cazary" style="width: 664px;">
<div class="cazary-commands-wrapper">
<ul class="cazary-commands-list">
<li unselectable="on" title="Size" class="cazary-command-fontsize">Size</li>
</ul>
<ul class="cazary-commands-list">
<li unselectable="on" title="Foreground Color" class="cazary-command-forecolor">Foreground Color</li>
</ul>
<ul class="cazary-commands-list">
<li unselectable="on" title="Background Color" class="cazary-command-backcolor">Background Color</li>
</ul>
<ul class="cazary-commands-list">
<li unselectable="on" title="Remove Format" class="cazary-command-removeformat">Remove Format</li>
</ul>
</div>
<iframe class="cazary-edit" src="javascript:" style="height: 39px;"></iframe>
<textarea id="summernote" class="required-preview field cazary-source" placeholder="Tell us all about your Advertisement. This description will be prominently displayed in your Advertisement notice. Feel free to adjust the fonts and background colour too." name="observations" cols="50" rows="10" style="display: none;"></textarea>
</div>
我的 Robotframework 代码尝试:
Select Frame //iframe[@class="cazary-edit"]
# First try
Input text //textarea[@id="summernote"] ${UniversalVariableforName}
# Second try
Input text //iframe[@class="cazary-edit"] ${UniversalVariableforName}
# Third try
Input text //div[@class="cazary"]//iframe[@class="cazary-edit"] ${UniversalVariableforName}
# Fourth try
Input text //body[@class="empty"] ${UniversalVariableforName}
# Fifth try
Input text //iframe[@class="cazary-edit"]//body[@class="empty"] ${UniversalVariableforName}
返回的错误: image
可能有Execute Javascript关键字的解决方案?
【问题讨论】:
-
文本区域在 iframe 之外,而且它是隐藏的。你无法与之互动。
-
您可以手动输入值吗?
-
嗨@Murthi,是的,我可以手动填写指定文本区域中的任何信息
-
请不要发布错误图片。花点时间将它们正确复制、粘贴并格式化到您的问题中。
-
如果您能够手动填写,很可能还有另一个元素实际上正在接受输入,然后通过 JS 将值传播到 textarea。找到另一个并定位它 - 通过操纵 textarea 的显示,您的测试将无法复制真实的用户交互。
标签: python selenium iframe robotframework selenium2library