I have made the Standard Table configurable. Please see here,
http://code.google.com/p/aost/wiki/Tellurium070Update#Standard_Table
I used your example to create a test case.
First the UI module:
public class GeneralTableModule extends DslContext {
public void defineUi() {
ui.StandardTable(uid: "GT", clocator: [id: "xyz"], ht: "tbody"){
TextBox(uid: "header: all", clocator: [:])
TextBox(uid: "row: 1, column: 1", clocator: [tag: "div", class:
"abc"])
Container(uid: "row: 1, column: 2"){
InputBox(uid: "Input", clocator: [tag: "input", class: "123"])
Container(uid: "Some", clocator: [tag: "div", class: "someclass"]){
Span(uid: "Span", clocator: [tag: "span", class: "x"])
UrlLink(uid: "Link", clocator: [:])
}
}
}
}
public void work(String input){
keyType "GT[1][2].Input", input
click "GT[1][2].Some.Link"
waitForPageToLoad 30000
}
}
The test case is
public class GeneralTableJUnitTestCase extends TelluriumMockJUnitTestCase {
private static GeneralTableModule gtm;
@BeforeClass
public static void initUi() {
registerHtmlBody("GeneralTable");
gtm = new GeneralTableModule();
gtm.defineUi();
useCssSelector(true);
useTrace(true);
}
@Before
public void connectToLocal() {
connect("GeneralTable");
}
@Test
public void testToJSON(){
System.out.println(gtm.toJSON("GT"));
}
@Test
public void testValidateUiModule(){
gtm.validate("GT");
}
@Test
public void testWork(){
useCache(false);
System.out.println(gtm.getText("GT[1][1]"));
gtm.work("Tellurium jQuery");
}
@AfterClass
public static void tearDown(){
showTrace();
}
}
The actual code can be found at
http://code.google.com/p/aost/source/browse/trunk/core/src/test/groovy/org/telluriumsource/module/GeneralTableModule.groovy
http://code.google.com/p/aost/source/browse/trunk/core/src/test/groovy/org/telluriumsource/ft/GeneralTableJUnitTestCase.java
You need the latest 0.7.0 core and custom selenium server from our Maven
repo.
Please let us know if this works for you.
Thanks,
Jian
On Fri, Jan 22, 2010 at 3:44 PM, super fan 911 <[email protected]>wrote:
> it is tbody that contains the th. And switching to StandardTable, it
> cannot even find the headers, th.
>
> Any suggestions?
>
> On Jan 21, 5:02 pm, Jian Fang <[email protected]> wrote:
> > Should the part
> > <tbody>
> > <tr>
> > <th>one</th>
> > <th>two</th>
> > <th>three</th>
> > </tr>
> > </tbody>
> >
> > be thead instead of tbody? If not, please let me know.
> >
> > If it is, sounds like you need to use StandardTable instead of Table.
> >
> > Thanks,
> >
> > Jian
> >
> > On Thu, Jan 21, 2010 at 5:26 PM, super fan 911 <[email protected]
> >wrote:
> >
> > > I have a table like this
> >
> > > <table id="xyz">
> > > <tbody>
> > > <tr>
> > > <th>one</th>
> > > <th>two</th>
> > > <th>three</th>
> > > </tr>
> > > </tbody>
> >
> > > <tbody>
> > > <tr>
> > > <td><div class="abc">some text</div></td>
> > > <td><input class="123" /><br/>
> > > <div class="someclass">
> > > <span class="x">some text</span><br/>
> > > <a href="#">link</a></div>
> > > </td>
> > > </tr>
> >
> > > </tbody>
> > > </table>
> >
> > > Then, I define my UI like this:
> >
> > > Container(uid: "myTbl", clocator: [:]) {
> >
> > > Table(uid: "headerTbl", clocator: [tbody: [position: "1"]]) {
> > > TextBox(uid: "header: 1", clocator: [:])
> > > TextBox(uid: "header: 2", clocator: [:])
> > > TextBox(uid: "header: 3", clocator: [:])
> > > }
> >
> > > Table(uid: "bodyTbl", clocator: [tbody: [position: "2"]]) {
> >
> > > TextBox(uid: "row: *, column: 1", clocator: [:])
> >
> > > Container(uid: "row: *, column: 2", clocator: [:]) {
> > > InputBox(uid: "box1", clocator: [class: "123"])
> >
> > > Container(uid: "c1", clocator: [class: "someclass"]) {
> >
> > > }
> >
> > > }
> >
> > > }
> >
> > > }
> >
> > > My problem is when i use isElementPresent to check for the object, it
> > > fails to find the container containing the objects on my second TD.
> > > It finds everything else including the input box on the second td.
> >
> > > So, I refer to the objects like this:
> >
> > > "myTbl.bodyTbl[1][2].box1" --> this will find the input box
> >
> > > "myTbl.bodyTbl[1][2].c1" ---> this says cannot find the container
> > > 'c1'
> >
> > > my goal is to work with the objects contained by 'c1'. But, if it
> > > fails to find the container, cannot move forward.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "tellurium-users" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > > [email protected]<tellurium-users%[email protected]>
> <tellurium-users%[email protected]<tellurium-users%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/tellurium-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "tellurium-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<tellurium-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/tellurium-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"tellurium-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tellurium-users?hl=en.