Chrome Selenium IDE随机数生成器 [英] Chrome Selenium IDE random number generator

查看:463
本文介绍了Chrome Selenium IDE随机数生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了类似的话题,但没什么确切的.

I saw similar topics but nothing exact.

使用Firefox和IDE时,我可以使用 StoreEval | Math.round(Math.random()* 99999999999),以创建特定长度的随机数.我现在已移至Chrome以使用IDE,并且不再可以选择"StoreEval".我尝试了所有可用的新存储"选项,但最终在日志中显示以下警告,并且未创建编号:

When I used Firefox and the IDE I was able to use StoreEval | Math.round (Math.random() * 99999999999) to create a random number of a specific length. I have now moved to Chrome to use the IDE and "StoreEval" is no longer an option. I have tried all the new "store" options available but end up with the below warning in the logs and the number is not created:

警告隐式定位器已被弃用,请将定位器更改为id = Math.round(Math.random()* 99999999999"

"Warning implicit locators are deprecated, please change the locator to id=Math.round (Math.random() * 99999999999"

对我需要使用/更改的内容有何想法?我承认,我不确定请将定位器更改为"是什么意思.

Any ideas on what I need to use/change? I will admit I am not exactly sure what "please change the locator to" means.

谢谢!

推荐答案

您必须在最新版本的Selenium IDE中使用执行脚本命令.

You must use execute script command in the last version of Selenium IDE.

  1. 右键单击任何命令,然后选择插入新命令"
  2. 插入以下内容.结果将存储在myRandomNumber

Command : execute script

Target : return Math.random()

Value : myRandomNumber

  • 然后您可以使用${myRandomNumber}

    注意: 您还可以查看生成的随机数.为此,添加另一个命令:

    Note: You can also see your generated random number. To do so, add another Command:

    Command : echo
    
    Target : ${myRandomNumber}
    

    这篇关于Chrome Selenium IDE随机数生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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