简体   繁体   English

Selenium IDE:如何从变量中选择?

[英]Selenium IDE: How to select from a variable?

I'm trying to select an option from a variable. 我正在尝试从变量中选择一个选项。

These don't work: 这些不起作用:

select | name=UserID | label=${varUserID} 

select | name=UserID | label=javascript{storedVars['varUserID']}

I keep getting: 我一直在:

Option with label '${varUserID}' not found

Option with label 'javascript{storedVars['varUserID']}' not found

What am I missing? 我错过了什么?

Sure here is the html: 肯定是html:

<label for="UN">User Name </label>
<select id="UN" name="UserID" style="width:250px;">
    <option value="12345">LastName, FirstName</option>
</select>

从您发布的内容来看,它失败了,因为标签不是您存储的用户ID,HTML表明标签是名称

<option value="12345">LastName, FirstName</option>

You do not have the variable set. 您没有变量集。 If your variable was set you'd see this error message: [error] Option with label 'x' not found 如果您设置了变量,则会看到以下错误消息:[error]找不到标签“x”的选项

and not Option with label '${varUserID}' not found 而不是找不到标签'$ {varUserID}'的选项

And your second example (with javascript) I think isn't working because you're trying to combine test with javascript, this would work: javascript{'label='+storedVars['variable']} 你的第二个例子(使用javascript)我觉得无法正常工作,因为你试图将测试与javascript结合起来,这样可行:javascript {'label ='+ storedVars ['variable']}

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

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