简体   繁体   English

如何检查文本值是否存在

[英]How to check for the existence of a text value

I am very much new to Robot Framework 我是Robot Framework的新手

I need to check for the existence of "Logout" button in the webpage. 我需要检查网页中是否存在“注销”按钮。

<button type="button" class="ant-btn" style="width: 80px; float: right; display: inline-block;"><span>Logout</span></button>

I have declared variables like * Variables * 我已声明变量,如*变量*

${logout_path}     xpath=//*/button[@class='ant-btn']/span

${l_path}      xpath=(//*/span[contains(text(),"Logout")])

and under * Test Cases * *测试案例*

Get Element Attribute  xpath=(//*/button[@class='ant-btn']/span)

Element Text Should be ${logout_path}  'Logout'

All the above syntax tested and FAILED. 以上所有语法都经过测试和失败。

How to check if this text 'Logout' is present in the Webpage, All I need is to check for the existence of this field. 如何检查网页中是否存在此文本“注销”,我只需检查是否存在此字段。

Kindly help with syntax. 请帮助语法。

Thank you :) 谢谢 :)

Element Text Should Be    ${logout_path}    Logout

欲了解更多信息,请访问: http//robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Element%20Text%20Should%20Be

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM