如何使用机器人框架验证文本,但某些文本除外 [英] How to verify text but except some text in line using robot framework

查看:42
本文介绍了如何使用机器人框架验证文本,但某些文本除外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须验证出现在网页上的文本,但在文本行中有动态措辞,我不知道如何验证这种情况.

I have to verify text that present on web page but in the text line have dynamic wording that I don't know how to verify this situation.

    Wait Until Element Contains    &{verScript}[Script]    Test automate for 50,000 time   timeout=60s

我想验证文本自动测试 50,000 次",但 50,000 是动态值.我不想在这个定位器中验证 50,000 并且可以为这个值进行任何操作.

I want to verify text "Test automate for 50,000 time" but 50,000 is dynamic value. I don't want to verify 50,000 in this locator and can it whatever for this value in line.

有什么可以帮我的吗.

推荐答案

using set

@{queryResultsA}=    split string     Test automate for 50,000 time
@{queryResultsB}=    split string     Test automate for XX,XXX time

${z} =  Evaluate    (set(${queryResultsA}) - set(${queryResultsB}))

## here ${z} will be 50,000

使用关键字

将返回页面上与给定字符串匹配的所有行.以下关键字将 Lines 作为一个字符串返回,并与换行符连接在一起

will return all lines on the page which are matching given string. the following keyword will return Lines as one string concatenated back together with newlines

Get Lines Containing String    Test automate for 

更多关键字

which 匹配部分和全文/字符串

使用正则表达式和模式匹配

这篇关于如何使用机器人框架验证文本,但某些文本除外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆