hzjdsc 发表于 2010-6-15 01:44:23

seleniumRC中,用java写循环语句怎么写啊?

我用整型变量代替Xpath中的数字为什么不可以?

goal1860 发表于 2010-6-17 16:09:10

for (int i=0; i<10; i++){
sel.click("//button" + i);
}

小米啊 发表于 2010-6-17 20:55:35

回复 2# 的帖子

这样写也可以吗?我一般都是
sel.click("//button[" + i + "]");

goal1860 发表于 2010-6-18 08:05:29

回复 3# 的帖子

you are definitely righ, if the html looks like:
<button/>
<button/>
.....
I just gave simple eample to LZ, assume the xml is:
<button1/>
<button2/>
...
Anyway there is not "button" in html. The correct one is "input", so neither of us are correct, hahah.
Sorry for English typing, no Chinese input here.
页: [1]
查看完整版本: seleniumRC中,用java写循环语句怎么写啊?