If you used cache and got some errors as follows,
com.thoughtworks.selenium.SeleniumException: ERROR: Cannot locate UI module
mainnav3
This is because your UI module cannot be found when Engine did UI module
group locating.
If the UI module is not loaded even after the page is full loaded, you can
mark this UI module
as not cacheable. In this way, you will not get any errors even you use
cache.
Take the above UI module as example, I can change it to
ui.Container(uid: "mainnav3", clocator: [tag: "div", class: "welcome"],
cacheable: false){
UrlLink(uid: "Link", clocator: [text: "Menu Nav"])
}
Then, the the following two tests passed.
@Test
public void testFlowWithSeleniumAndCaching() {
connect("JettyLogon");
useTelluriumApi(false);
useCache(true);
jlm.click("Welcome.MenuLink");
jlm.waitForPageToLoad(10000);
assertTrue("Did not find main menu",
mnm.isElementPresent("mainnav"));
assertFalse(mnm.isElementPresent("mainnav3.Link"));
mnm.click("mainnav2.suppliers");
mnm.waitForPageToLoad(20000);
assertTrue(jlm.isElementPresent("Welcome.MenuLink"));
useCache(false);
}
@Test
public void testFlowWithTelluriumAndCaching() {
connect("JettyLogon");
useTelluriumApi(true);
useCache(true);
jlm.click("Welcome.MenuLink");
jlm.waitForPageToLoad(10000);
assertTrue("Did not find main menu",
mnm.isElementPresent("mainnav"));
assertFalse(mnm.isElementPresent("mainnav3.Link"));
mnm.click("mainnav2.suppliers");
mnm.waitForPageToLoad(20000);
assertTrue(jlm.isElementPresent("Welcome.MenuLink"));
useTelluriumApi(false);
useCache(false);
}
On Fri, Feb 5, 2010 at 4:29 PM, Jian Fang <[email protected]> wrote:
> Hi,
>
> html snippets:
>
> JettyLogon.html
>
> <div class="welcome">
> <a href="http://localhost:8080/MenuNav.html">Menu Nav</a>
> </div>
>
> MenuNav.html
>
> <div class="mainMenu">
> <a href="http://localhost:8080/JettyLogon.html">Events</a>
> <a href="http://localhost:8080/JettyLogon.html">Suppliers</a>
> <a href="http://localhost:8080/JettyLogon.html">Venues</a>
> <a href="http://localhost:8080/JettyLogon.html">Booking Report</a>
> <a href="http://localhost:8080/JettyLogon.html">Notifications</a>
> <a href="http://localhost:8080/JettyLogon.html">Help</a>
> </div>
>
>
> Here are my test cases.
>
> Ui Modules:
>
> public class JettyLogonModule extends DslContext {
> public void defineUi() {
> ui.Container(uid: "Welcome", clocator: [tag: "div", class: "welcome"]){
> UrlLink(uid: "MenuLink", clocator: [text: "Menu Nav"])
> }
> }
>
> class MenuNavModule extends DslContext {
>
> public void defineUi(){
> ui.Container(uid: "mainnav", clocator: [tag: "div", class: "mainMenu"],
> group: true) {
> UrlLink(uid: "events", clocator: [text: "Events"])
> UrlLink(uid: "suppliers", clocator: [text: "Suppliers"])
> UrlLink(uid: "venues", clocator: [text: "Venues"])
> UrlLink(uid: "bookingReport", clocator: [text: "Booking Report"])
> UrlLink(uid: "notifications", clocator: [text: "Notifications"])
> UrlLink(uid: "help", clocator: [text: "Help"])
> }
>
> ui.Container(uid: "mainnav2", clocator: [tag: "div", class:
> "mainMenu"]) {
> UrlLink(uid: "events", clocator: [text: "Events"])
> UrlLink(uid: "suppliers", clocator: [text: "Suppliers"])
> UrlLink(uid: "venues", clocator: [text: "Venues"])
> UrlLink(uid: "bookingReport", clocator: [text: "Booking Report"])
> UrlLink(uid: "notifications", clocator: [text: "Notifications"])
> UrlLink(uid: "help", clocator: [text: "Help"])
> }
>
> ui.Container(uid: "mainnav3", clocator: [tag: "div", class:
> "welcome"]){
> UrlLink(uid: "Link", clocator: [text: "Menu Nav"])
> }
> }
> }
>
> As you can see UI module "mainnav3" does not exist
>
> @Test
> public void testFlowWithSelenium() {
> connect("JettyLogon");
> useTelluriumApi(false);
> useCache(false);
> jlm.click("Welcome.MenuLink");
> jlm.waitForPageToLoad(10000);
> assertTrue("Did not find main menu",
> mnm.isElementPresent("mainnav"));
> assertFalse(mnm.isElementPresent("mainnav3.Link"));
> mnm.click("mainnav2.suppliers");
> mnm.waitForPageToLoad(20000);
> assertTrue(jlm.isElementPresent("Welcome.MenuLink"));
> }
>
> @Test
> public void testFlowWithTellurium() {
> connect("JettyLogon");
> useTelluriumApi(true);
> useCache(false);
> jlm.click("Welcome.MenuLink");
> jlm.waitForPageToLoad(10000);
> assertTrue("Did not find main menu",
> mnm.isElementPresent("mainnav"));
> assertFalse(mnm.isElementPresent("mainnav3.Link"));
> mnm.click("mainnav2.suppliers");
> mnm.waitForPageToLoad(20000);
> assertTrue(jlm.isElementPresent("Welcome.MenuLink"));
> useTelluriumApi(false);
> }
>
> The two tests passed.
>
> Thanks,
>
> Jian
>
>
>
--
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.