选择列表中的下一个值,而不仅仅是在有重复项时返回第一个值

时间:2022-09-22 07:36:54

i'm working with a list of invoice elements = type, with a corresponding sub-type, however since Selenium IDE only returns the first matched value, the sub-type is incorrect and I do not know how to move to the next Type value with the correct Sub-type value.

我正在使用发票元素列表=类型,具有相应的子类型,但是由于Selenium IDE仅返回第一个匹配的值,子类型不正确,我不知道如何移动到下一个类型值使用正确的子类型值。

Say the list

说清单

Red Car, subtype = 1
Blue Car, subtype = 2
Yellow Car, subtype = 3
Red Car, subtype = 4
Blue Car, subtype = 5

I want to select the Red Car with sub-type = 4, However seleniumIDE automatically returns the first Red Car match and forgets about the others, but I want look through ALL of the Red Cars. This then crashes my test script as the sub-type for the returned Red Car sub-type is 1 and not 4.

我想选择子车型= 4的红色轿车,但是seleniumIDE会自动返回第一辆红色赛车并忘记其他车型,但我希望查看所有红色车辆。这会导致我的测试脚本崩溃,因为返回的Red Car子类型的子类型是1而不是4。

 public void testQqqqqq() throws Exception {
    selenium.open("/invoicing/edit_car/-1?set_entityid=55184");
    selenium.click("css=div.content > div.buttonbar > button.primary");
    selenium.select("id=type", "label=Red Car");
    selenium.select("id=type", "label=Red Car");

as you can see, i've selected the first Red Car, and the second Red Car, but it just shows label=Red Car which always returns the first one even though its sub-type is wrong.

正如你所看到的,我选择了第一辆红色轿车和第二辆红色轿车,但它只是显示了标签=红色轿车,即使它的子类型错误也总是返回第一个。

any help is much appreciated, thanks!

非常感谢任何帮助,谢谢!

1 个解决方案

#1


0  

Instead of label just try with index. (If your options are always in same order)

而不是标签只是尝试索引。 (如果您的选项始终保持相同的顺序)

Selenium.select("id=type", "index=4");

#1


0  

Instead of label just try with index. (If your options are always in same order)

而不是标签只是尝试索引。 (如果您的选项始终保持相同的顺序)

Selenium.select("id=type", "index=4");