Letractively / aost

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

Tellurium does not return correct row number with CSS selector #494

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
<table id="hello">
<tbody>
       <tr>
               <td>1</td>
               <td>1</td>
               <td>1</td>
               <td>1</td>
               <td>1</td>
       </tr>
       <tr>
               <td>2</td>
               <td>2</td>
               <td>2</td>
               <td>2</td>
               <td>2</td>
       </tr>
       <tr>
               <td>3</td>
               <td>3</td>
               <td>3</td>
               <td>3</td>
               <td>3</td>
       </tr>
       <tr>
               <td>4</td>
               <td>4</td>
               <td>4</td>
               <td>4</td>
               <td>4</td>
       </tr>
       <tr>
               <td>5</td>
               <td>5</td>
               <td>5</td>
               <td>5</td>
               <td>5</td>
       </tr>
</tbody>
</table>

with the ui

ui.Table(uid: "data", clocator: [ id: "hello"], group:"true"){

       TextBox(uid: "{row: all, column: 1}", clocator: [:])
       TextBox(uid: "{row: all, column: 2}", clocator: [:])
       TextBox(uid: "{row: all, column: 3}", clocator: [:])
       TextBox(uid: "{row: all, column: 4}", clocator: [:])
       TextBox(uid: "{row: all, column: 5}", clocator: [:])

}

def nrow  =  getTableMaxRowNum("data")
println nrow

and I get

00:03:42.617 INFO - Command request:
getBundleResponse[[{"uid":"data","args":["jquery=#hello> tbody >
tr:has(td)"],"name":"getCssSelectorCount","sequ":2}], ] on session
7dc159fe8f2b480d9663493dec35f3
2
00:03:42.703 INFO - Got result: ERROR: Element #hello > tbody >
tr:has(td) not found
message: Element #hello> tbody > tr:has(td) not found, name: Error,
filename: http://localhost:4444/selenium-server/core/scripts/htmlutils.js,
linenumber: 814.
JavaScript Error Stack:
SeleniumError("Element #hello> tbody > tr:has(td) not found")@http://
localhost:4444/selenium-server/core/scripts/htmlutils.js:814

........

   Environment Variables:
     configFileName: TelluriumConfig.groovy
     configString:
     useEngineCache: false
     useClosestMatch: false
     useMacroCommand: false
     maxMacroCmd: 5
     useTelluriumApi: false
     locatorWithCache: true
     useCSSSelector: true
     useTrace: false
     logEngine: false
     locale: en_US

Original issue reported on code.google.com by John.Jian.Fang@gmail.com on 3 Nov 2010 at 3:03

GoogleCodeExporter commented 8 years ago
More details see thread

http://groups.google.com/group/tellurium-users/browse_thread/thread/8492b6b5eda0
e195

and test TableRowTestCase in tellurium core.

Original comment by John.Jian.Fang@gmail.com on 3 Nov 2010 at 3:05

GoogleCodeExporter commented 8 years ago
The problem is in the getCSSSelector method. The updated one should be

Selenium.prototype.getCssSelectorCount = function(locator) {
    !tellurium.logManager.isUseLog || fbLog("GetCssSelectorCount for Locator", locator);
/*    if(locator.startsWith("jquery=")){
        locator = locator.substring(7);
    }else if(locator.startsWith("uimcal=")){
        var cal = JSON.parse(locator.substring(7), null);
         locator = cal.locator;
    }*/
    !tellurium.logManager.isUseLog || fbLog("Parsed locator", locator);
    var $e = teJQuery(this.browserbot.findElementOrNull(locator));
    !tellurium.logManager.isUseLog || fbLog("Found elements for CSS Selector", $e.get());
    if ($e == null)
        return 0;

    return $e.length;
};

Original comment by John.Jian.Fang@gmail.com on 3 Nov 2010 at 7:06