无法填写隐藏文本区域元素

2024-09-30 10:30:41 发布

您现在位置:Python中文网/ 问答频道 /正文

F1,需要一些关于使用Robotframework的隐藏元素的帮助或提示。
问题在于,要填充文本区域中的任何文本,我需要将文本区域的状态从display:none;to display:block;

Needed text area for input

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代码尝试:

^{pr2}$

返回的错误: image

是否有一个带有Execute Javascript关键字的解决方案?在


Tags: 文本divtitlestyleondisplayliul
1条回答
网友
1楼 · 发布于 2024-09-30 10:30:41

相关的<textarea><iframe class="cazary-edit">之外。因此,我们不需要切换到<iframe>

要将文本发送到Input字段,您可以尝试:

  • 使用xpath作为:

    "//textarea[@class='required-preview field cazary-source' and @id='summernote']"
    
  • Click首先是Input字段。

  • 接下来Clear字段Input。在
  • 最后试着发短信。在

更新:

由于相关的textareastyle属性设置为"display: none;",我们必须通过JavascriptExecutor更改为"display: block;"然后发送文本。在

Python示例代码:

^{pr2}$

相关问题 更多 >

    热门问题