nikgoodley-ibboost / aost

Automatically exported from code.google.com/p/aost
0 stars 0 forks source link

Table operations for large size one seems to be very slow #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The main reason for this is because we have to call Selenium server many
times. If we can reduce the call number, we can speed thing up.

Original issue reported on code.google.com by John.Jian.Fang@gmail.com on 3 Oct 2008 at 8:19

GoogleCodeExporter commented 9 years ago

Original comment by John.Jian.Fang@gmail.com on 3 Oct 2008 at 8:19

GoogleCodeExporter commented 9 years ago
Haroon,

Do you have any suggestion for this?

Original comment by John.Jian.Fang@gmail.com on 3 Oct 2008 at 8:19

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Thanks.

Original comment by John.Jian.Fang@gmail.com on 5 Oct 2008 at 9:23

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Committed, please verify the testng reference project. 

Thanks,

Jian

Original comment by John.Jian.Fang@gmail.com on 10 Oct 2008 at 1:09