F1,需要使用Robotframework的隐藏元素提供一些帮助或提示
问题在于,要填写文本区域中的任何文本,我需要更改var arr = [-62,345,10]
var newArr = [0].concat(arr).slice(0, -1).map(function(elem, i) {
return arr[i] - elem;
})
console.log(newArr)
display:none;
Code that I see from WebDev Tool
代码本身:
to display:block;
我的Robotframework代码尝试:
<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>
返回的错误: image
可能有执行Javascript 关键字的解决方案吗?
答案 0 :(得分:1)
相关的 <textarea>
不在 <iframe class="cazary-edit">
之内。因此,我们无需切换到 <iframe>
要将文字发送到 Input
字段,您可以尝试:
将xpath
用作:
"//textarea[@class='required-preview field cazary-source' and @id='summernote']"
Click
Input
字段。
Clear
Input
字段。由于相关的textarea
将style
属性设置为 "display: none;"
,我们必须更改为 "display: block;"
通过 JavascriptExecutor
然后发送文字。
driver.execute_script("document.getElementById('ID').style.display='block';")