是否有任何方法可以在柏树中自动化这种情况,以便随机选择随机国家/地区/地区的下拉列表?
我正在自动化页面。在下拉赛中,我每次运行测试案例都会随机选择一个国家。但是如何映射Math.random
功能选择的随机国家,其中我将所有国家添加到数组中。
var country =[" "]
var randomItem = country[Math.floor(Math.random() * country.length)];
如果通过上述代码随机选择印度,我需要从第二个下拉列表中随机选择印度的任何一个州。
I am automating the page. in the drop-down, I am trying to choose a country randomly every time I run the test case. but how to map random country chosen by the math.random
function where I added all the countries into the array.
var country =[" "]
var randomItem = country[Math.floor(Math.random() * country.length)];
If India is selected randomly by the above code, I need to choose any one of the states from India randomly from the second drop down.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在固定装置文件夹中创建
state.json
文件。假设您的下拉元素是
选择
和选项
。Inside the Fixtures folder create a
state.json
file like this.Assuming your dropdown elements are
select
andoption
.