51Testing软件测试论坛

标题: seleniumRC中,用java写循环语句怎么写啊? [打印本页]

作者: hzjdsc    时间: 2010-6-15 01:44
标题: seleniumRC中,用java写循环语句怎么写啊?
我用整型变量代替Xpath中的数字为什么不可以?
作者: goal1860    时间: 2010-6-17 16:09
for (int i=0; i<10; i++){
  sel.click("//button" + i);
}
作者: 小米啊    时间: 2010-6-17 20:55
标题: 回复 2# 的帖子
这样写也可以吗?我一般都是
sel.click("//button[" + i + "]");
作者: goal1860    时间: 2010-6-18 08:05
标题: 回复 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.




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2