Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Selenium ide 在selenium IDE中,如何存储警报弹出窗口的文本消息值_Selenium Ide - Fatal编程技术网

Selenium ide 在selenium IDE中,如何存储警报弹出窗口的文本消息值

Selenium ide 在selenium IDE中,如何存储警报弹出窗口的文本消息值,selenium-ide,Selenium Ide,selenium ide中使用哪个命令存储/验证警报或确认弹出窗口的文本值存储文本(定位器,变量名)selenium ide中使用哪个命令存储文本值 比如说, 在警报消息中,文本值具有定位器X 您想将该消息存储在变量Var 因此,您可以编写命令storeText | X | Var 现在,为了将此消息与定义的消息进行比较,首先将消息存储在变量中 存储(表达式,variableName)命令用于存储变量中的值 在您的情况下,您可以将消息Y存储在变量Var1 因此,您可以编写命令store |

selenium ide中使用哪个命令存储/验证警报或确认弹出窗口的文本值

存储文本(定位器,变量名)selenium ide中使用哪个命令存储文本值

比如说,

  • 在警报消息中,文本值具有定位器X
  • 您想将该消息存储在变量Var
因此,您可以编写命令storeText | X | Var

现在,为了将此消息与定义的消息进行比较,首先将消息存储在变量中

存储(表达式,variableName)命令用于存储变量中的值

在您的情况下,您可以将消息Y存储在变量Var1

因此,您可以编写命令store | Y | Var1

要比较消息,您可以使用下面的命令

verifyEval|storedVars['Var']==storedVars['Var1']| true

如果有两个脚本,则按编写的方式运行此脚本将导致测试通过 字符串已匹配,如果两个字符串不匹配,则会以[error]失败


我希望它对您有用。

如果您谈论的是默认javascript警报或确认,则有两个命令:

storeAlert

Returns:
    The message of the most recent JavaScript alert

Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.

Getting an alert has the same effect as manually clicking OK. If an alert is generated but you do not consume it with getAlert, the next Selenium action will fail.

Under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.

Selenium does NOT support JavaScript alerts that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until someone manually clicks OK.
storeConfirmation

Returns:
    the message of the most recent JavaScript confirmation dialog

Retrieves the message of a JavaScript confirmation dialog generated during the previous action.

By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the chooseCancelOnNextConfirmation command.

If an confirmation is generated but you do not consume it with getConfirmation, the next Selenium action will fail.

NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible dialog.

NOTE: Selenium does NOT support JavaScript confirmations that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK. 

也请检查此项:

Welcome@vaishalibajpait当弹出窗口显示“确定”时,此命令不起作用button@VaishaliBajpai当通过ok按钮弹出窗口显示警报消息时,尝试以下操作1)存储警报消息的文本storeAlert | alertText 2)然后将警报文本值存储到变量,以便您可以将其与预期消息。store |${alertText}| Var-它将警报文本值存储在变量“Var”中。我希望它对你有用you@Avinsh帕特尔。。。谢谢它的工作。。。但我仍然无法单击确认/警报弹出窗口上的“是”按钮