活动
最新
False
横幅背景图像
工作流活动
上次更新日期 2024年4月22日

验证带有运算符的表达式

通过与带有运算符的给定表达式相关的断言来验证表达式。

定义

命名空间: UiPath.Testing.API

程序集: UiPath.Testing.Activities.Api(在 UiPath.Testing.Activities.Api.dll 中)

重载

  
VerifyExpressionWithOperator(object, Comparison, object, string)通过与带有运算符的给定表达式相关的断言来验证表达式。
VerifyExpressionWithOperator(object, Comparison, object)string, bool, string, bool, bool)通过与带有运算符的给定表达式相关的断言来验证表达式。 除了验证之外,您还可以执行其他配置,例如配置输出消息格式,或者在断言失败时截取屏幕截图。

VerifyExpressionWithOperator(object, Comparison, object, string)

通过与带有运算符的给定表达式相关的断言来验证表达式。

bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression
       string outputMessageFormat = null
)bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression
       string outputMessageFormat = null
)
firstExpression 对象
验证流程中的第一个表达式。
operatorValue Comparison
要用于验证两个表达式的可能数学运算符。
secondExpression 对象
验证流程中的第二个表达式。
outputMessageFormat 字符串
输出消息的格式。 支持的参数包括:
  • {LeftExpression}
  • {LeftExpressionText}
  • {RightExpression}
  • {RightExpressionText}
  • {Result}
  • {Operator}
例如,您可以使用以下输出消息格式:
"{LeftExpressionText}
    (with value {LeftExpression}) {Operator} {RightExpressionText} (with value {RightExpression})
    has result {Result}."{LeftExpressionText}
    (with value {LeftExpression}) {Operator} {RightExpressionText} (with value {RightExpression})
    has result {Result}.
此消息格式指示使用特定运算符在两个值或变量( LeftExpressionRightExpression )之间进行比较。 {Result}表示此比较的结果。

VerifyExpressionWithOperator(object, Comparison, object)string, bool, string, bool, bool)

通过与带有运算符的给定表达式相关的断言来验证表达式。 除了验证之外,您还可以执行其他配置,例如配置输出消息格式,或者在断言失败时截取屏幕截图。

bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression,
	string outputMessageFormat,
	bool continueOnFailure,
	string alternativeVerificationTitle,
	bool takeScreenshotInCaseOfFailingAssertion,
	bool takeScreenshotInCaseOfSucceedingAssertion
)bool VerifyExpressionWithOperator(
	Object firstExpression,
	Comparison operatorValue,
	Object secondExpression,
	string outputMessageFormat,
	bool continueOnFailure,
	string alternativeVerificationTitle,
	bool takeScreenshotInCaseOfFailingAssertion,
	bool takeScreenshotInCaseOfSucceedingAssertion
)
firstExpression 对象
验证流程中的第一个表达式。
operatorValue Comparison
要用于验证两个表达式的可能数学运算符。
secondExpression 对象
验证流程中的第二个表达式。
outputMessageFormat 字符串
输出消息的格式。 支持的参数: {LeftExpression}{LeftExpressionText}{RightExpression}{RightExpressionText}{Result}{Operator}。 示例: {LeftExpressionText}”(值为 {LeftExpression}{Operator} {RightExpressionText} (值为 {RightExpression})的结果为 {Result}
continueOnFailure 布尔值
指定如果活动引发错误,是否仍应继续自动化。默认值为 False。因此,如果该字段为空且活动引发错误,系统将停止执行项目。如果该值设为“True”,则无论出现何种错误,系统都将继续执行项目。
alternativeVerificationTitle 字符串
此标题将显示在 Orchestrator 中。
takeScreenshotInCaseOfFailingAssertion 布尔值
如果设置为 True,则在验证失败时截取目标流程的屏幕截图。
takeScreenshotInCaseOfSucceedingAssertion 布尔值
如果设置为 True,则在验证成功后截取目标流程的屏幕截图。

返回值

如果验证通过/成功,则为“True”;如果验证失败,则为“False”。

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.