Reputation: 143
I want to add the following code into a textarea input, how should I do this using Robot Framework?
<table style="margin-top: 1em; margin-left:1em;">
<tbody>
<tr>
<td><img src="/static/31bc33ac/images/48x48/orange-square.png" style="width: 48px; height: 48px; " class="icon-orange-square icon-xlg"></td>
<td style="vertical-align:middle">
<p><span>Started by user <a href="/user/vkatkar">Vaishali Katkar</a></span></p>
</td>
</tr>
<tr>
<td><img src="/static/31bc33ac/plugin/metrics/images/48x48/clock.png" alt="" style="width: 48px; height: 48px; margin-right:1em;"></td>
<td style="vertical-align:middle">
<p>This run spent 1 sec waiting in the queue.</p>
</td>
</tr>
<tr>
<td><img src="/static/31bc33ac/plugin/git/icons/git-48x48.png" alt="" style="width: 48px; height: 48px; margin-right:1em;"></td>
<td style="vertical-align:middle"><b>Revision</b>: 861b6af99e7899d0b725459417e9fadfa25e2706
<ul>
<li>develop</li>
</ul>
</td>
</tr>
</tbody>
</table>
Upvotes: 0
Views: 3847
Reputation: 6981
The HTML string contains many characters that should normally be escaped. For this reason it's easier to load it from a regular text file into a variable and then output that variable into the desired textarea element.
In the below example this being done using an example site:
FillInForm.robot
*** Settings ***
Library OperatingSystem
Library Selenium2Library
Test Setup Start Browser
Test Teardown Close Browser
Suite Teardown Close All Browsers
*** Test Cases ***
Fill Textarea with HTML code
${file_contents} Get File ./htmlcode.txt
Input Text name=longtext ${file_contents}
Sleep 3s
*** Keywords ***
Start Browser
Open Browser http://www.echoecho.com/htmlforms08.htm Chrome
htmlcode.txt
Contains the HTML code you want to insert.
Upvotes: 3