18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Problem with GWT recording / play back using Sahi

raosgmraosgm Members
edited December 2012 in Sahi - Open Source
OS Name :Windows XP
Browser Name and version : IE 8
Sahi Build : V 3.5

HI Team,

Facing trouble in automating GWT application .The issue is i can able to record the script but during play back the script fails cos of the the sahi unable to recognize the ID of the GWT component .The buit using Cell table/Data Grid methods.

I would post the code if required.

Awaiting your help

Thanks

Comments

  • Hi,

    GWT automation can be tricky and it all comes down to using stable recognition logic. GWT creates some random ids and classes and if you recognize the items with these ids and classes, the test will fail when you run it next time as these ids will be changed. You can use the context to recognise the elements. This will ensure the stability of your test case. Essentially Sahi is not affected by the technology behind your application, be it GWT or EXT JS or something else. It is your testcases that should be robust. If you can share your APP and some test script, I may be able to indicate more clearly.

    Thanks,
  • Hi raosgm,

    Try using _in(element) or _near(element) ...etc for dynamic elements.
    Please refer this browser accessor apis (http://sahi.co.in/w/browser-accessor-apis).
    Good Luck!!
  • HI hungrYpYth0n

    please find the below mentioned script i used for automating a GWT application

    click(_div("12 Dec 2012"));
    _click(_cell("5"));
    _click(_cell("GGH-4N5BOC GGH-4N5BAD GGH-4N5BHD GGH-4N5BKD"));// cell id which changes it fails during playback
    _click(_cell("GGH-4N5BOC GGH-4N5BAD GGH-4N5BHD GGH-4N5BKD GGH-4N5BID"));
    _setValue(_textarea(0), "For Test");
    _setSelected(_select(0), "ATI1120072206-1");
    _setSelected(_select(1), "Food");
    _click(_div("0.00"));// i have alternate ID for this div but it works once when i try to run the script it fails.
    _click(_div(105));
    _setValue(_textbox(1), "50");
    _click(_div("0.00"));
    _click(_div(106));
    _setValue(_textbox(1), "10");

    help would be appreciated

    Thanks in advance
    Regards:
    Raosgm
  • Error which i've got while running is pasted below:
    net.sf.sahi.command.CommandExecuter execute
    WARNING: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:55)
    at net.sf.sahi.LocalRequestProcessor.handleDyn(LocalRequestProcessor.jav
    a:67)
    at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProces
    sor.java:40)
    at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:209)
    at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:86)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
    at net.sf.sahi.playback.ScriptFactory.getScript(ScriptFactory.java:25)
    at net.sf.sahi.playback.ScriptFactory.getScript(ScriptFactory.java:32)
    at net.sf.sahi.command.Player.setScript(Player.java:99)
    at net.sf.sahi.command.Player.resetScript(Player.java:96)
    ... 10 more
Sign In or Register to comment.