Не удается заполнить элемент скрытой текстовой области

F1, нужна помощь или подсказки со скрытым элементом с помощью Robotframework.
Проблема состоит в том, что для заполнения любого текста в текстовой области мне нужно изменить состояние текстовой области с display:none;to display:block;

Необходимая текстовая область для ввода

Код, который я вижу из 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}

Ошибки, которые были возвращены: изображение

Может быть, есть решение с ключевым словом Execute Javascript?

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 затем отправьте текст.

Пример кода Python:

driver.execute_script("document.getElementById('ID').style.display='block';") 
Другие вопросы по тегам