Closed GoogleCodeExporter closed 9 years ago
Original comment by John.Jian.Fang@gmail.com
on 3 Oct 2008 at 8:19
Haroon,
Do you have any suggestion for this?
Original comment by John.Jian.Fang@gmail.com
on 3 Oct 2008 at 8:19
Haroon, I think we can improve the methods of get table row number and column
number.
The current implementation needs to call Selenium server multiple times, which
can be
improved if we can use java script to get back the number by one call to the
selenium
sever. It should not be complicated and does require the JQuery library. If you
are
familiar with Java script, I would like you to take over the task. What do you
think?
Thanks,
Jian
Original comment by John.Jian.Fang@gmail.com
on 5 Oct 2008 at 1:56
I am familiar with java script and will look into this.
Thanks
Haroon
Original comment by haroonzone@gmail.com
on 5 Oct 2008 at 9:12
Thanks.
Original comment by John.Jian.Fang@gmail.com
on 5 Oct 2008 at 9:23
Haroon,
We may be able to use the method getXpathCount to solve the problem directly. I
will
test if that will work tonight.
Thanks,
Jian
Original comment by John.Jian.Fang@gmail.com
on 9 Oct 2008 at 7:12
Jian, please feel free to try getXpathCount method. But can you please point me
where you are going to make this change. It would help me in getting familiar
with
the code base.
I was looking at the Table.groovy file and assume that we need to make some
changes
in this class file to resolve this issue. Is it correct?
Thanks
Haroon
Original comment by haroonzone@gmail.com
on 9 Oct 2008 at 8:58
Yes, at the Table.groovy file. I would make the following changes,
int getTableHeaderColumnNum(Closure c) {
/*
int column = 1
String rl = c(this.locator)
Accessor accessor = new Accessor()
while (accessor.isElementPresent(rl + getHeaderLocator(column))) {
column++
}
column--
return column
*/
String rl = c(this.locator)
Accessor accessor = new Accessor()
String xpath = rl + "/tbody/tr[1]/th"
int columnum = accessor.getXpathCount(xpath)
return columnum
}
int getTableMaxRowNum(Closure c) {
/* int row = 1
int column = 1
String rl = c(this.locator)
Accessor accessor = new Accessor()
while (accessor.isElementPresent(rl + getCellLocator(row, column))) {
row++
}
row--
return row
*/
String rl = c(this.locator)
Accessor accessor = new Accessor()
String xpath = rl + "/tbody/tr/td[1]"
int rownum = accessor.getXpathCount(xpath)
return rownum
}
int getTableMaxColumnNum(Closure c) {
/*
int row = 1
int column = 1
String rl = c(this.locator)
Accessor accessor = new Accessor()
while (accessor.isElementPresent(rl + getCellLocator(row, column))) {
column++
}
column--
return column
*/
String rl = c(this.locator)
Accessor accessor = new Accessor()
String xpath = rl
if (hasHeader()) {
//if we have header, need to increase the row number by one
xpath = xpath + "/tbody/tr[2]/td"
} else {
xpath = xpath + "/tbody/tr[1]/td"
}
int columnum = accessor.getXpathCount(xpath)
return columnum
}
The StandardTable also needs to be updated. I cannot test it now because of
network
problem. I will test it tonight and if it works, I will commit the changes.
Thanks,
Jian
Original comment by John.Jian.Fang@gmail.com
on 9 Oct 2008 at 9:03
Committed, please verify the testng reference project.
Thanks,
Jian
Original comment by John.Jian.Fang@gmail.com
on 10 Oct 2008 at 1:09
Original issue reported on code.google.com by
John.Jian.Fang@gmail.com
on 3 Oct 2008 at 8:19