24

How to parse HTML in Robot Framework

 3 years ago
source link: https://www.codesd.com/item/how-to-parse-html-in-robot-framework.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to parse HTML in Robot Framework

advertisements

Below is my text and it store in the ${Tooltipdata}:

    <hr><b><strong>Task Details</strong></b><hr><b>Date Created: </b> 02/21/2014 07:52pm<br>
<b>Date Modified: </b> 02/24/2014 05:47pm<br><b>Assigned to: </b> Administrator<br>
<b>Created By: </b> Administrator<br><b>Status: </b> Pending Input<br><b>Description:
 </b> test<br>

I want to result as like this:

Task Details  Date Created:  02/21/2014 07:52pm    Date Modified:  02/24/2014 05:47pm    Assigned to:  Administrator
 Created By:  Administrator
 Status:  Pending Input
 Description:  test.

Simple I want to remove HTML tag.


you could try using a regex :

import re

data = "<hr><b><strong>Task Details</strong></b><hr><b>Date Created: </b> 02/21/2014 7:52pm<br><b>Date Modified: </b> 02/24/2014 05:47pm<br><b>Assigned to: </b> Administrator<br><b>Created By: </b> Administrator<br><b>Status: </b> Pending Input<br><b>Description: </b> test<br>"
# get text without tag
result = re.split(r'<[A-z\/]*>', data)

# print with removed tag
print ''.join(result)

Related Articles

How to install wxPython / RIDE robot framework on MAC? The wxPython did not work after run ride.py (on MAC OS)

I try to install Robot Framework RIDE to MAC(version 10.9.5) today. python version is 2.7.9(is default version in MAC) installed wxPython 2.8.12.1, install success. install Robot Framework(robotframework-ride-1.1) success. when I try to open graphic

how to parser html dom in php

<div id="productDetails" class="tabContent active details"> <span> <b>Case Size:</b> </span> 44mm <br> <span> <b>Case Thickness:</b> </span> 13mm <br> <span> <b

How to parse html by a part of a class name with JSOUP?

I'm trying to get a piece of html, something like: <tr class="myclass-1234" rel="5678"> <td class="lst top">foo 1</td> <td class="lst top">foo 2</td> <td class="lst top">

How to parse html in the directive template

How i can parse html in directive template??? app.directive('user', function(){ return { restrict: 'E', scope: false, template: '<div class="clearfix buttons-container" ng-bind-html-unsafe="current_text"></div>' } }); //in

How to use RIDE with Robot Framework implemented in Jython?

Our Automation framework is implemented using the Robot Framework in Jython, can anyone suggest how I can use RIDE for writing my testcases. Currently I am using Eclipse as an editor.RIDE and RobotFramework are two different things. RIDE is an IDE (R

How to parse html text in plain text without assigned string?

How do I parse html text into plain text without attributed string? This is my code: (NSString *)convertHTML:(NSString *)html { NSScanner *myScanner; NSString *text = nil; myScanner = [NSScanner scannerWithString:html]; while ([myScanner isAtEnd] ==

How to parse html in a textarea input and add Class to td elements

My problem is this: I'm submitting a form with a textarea input, which contains an HTML table in the content with specific values in the TD elements which I am trying to parse and add a class to the TD based on that value; then save that back to the

How a test called by Robot Framework returns information to the console

I have a robot framework test suite that calls a python method. I would like that python method to return a message to the console without failing the test. Specifically I am trying to time a process. I can use "raise" to return a message to the

how to parse HTML already store in the variable

I want to parse a shoutcast page like this : http://relay.181.fm:8800/played.html So, i just make ajax to call a php file. The php file return all the content of the page. i store the html content to a var in js. Here is the code: PHP: function getco

How to parse html in a client-side script?

What's the best way to create scripts for a browser? I need to parse some html pages on different domains I am on windows and use firefox most of all.If it's just about retrieving the pages to do whatever you want with it, the built-in urllib module

How to compress html with Play Framework

In order to improve the readability in the Scala forms I use indentation and new lines frequently. But when I verify the HTML when my play application is up and running I see a lot of white spaces and unnecessary line breaks. is there any why to comp

How to parse html source code with ruby ​​/ nokogiri?

I've successfully used ruby (1.8) and nokogiri's css parsing to pull out front facing data from web pages. However I now need to pull out some data from a series of pages where the data is in the "meta" tags in the source code of the page. One o

How to parse html text by div id to an array in jquery or javascript?

Hi i want to add a few hidden divs to an array and show them afterwards in different places one by one. I am a rookie so i will really appreciate your patience. http://jsfiddle.net/alexnode/qSZx6/1/ i have three divs like <div id='a'><p>Aorum&

Download a file in a browser using Robot Framework Test

I'm writing Test Cases using Robot Framework and Selenium for my Web application. I tried to Upload a file, but I can't its failing. My Code is *** Variables *** ${TVAURL} http://localhost:1500/ ${Browser} Firefox TC_01: Enter into the application [D

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK