I created the following test case  and seems it produced the same result as
you described, i.e., return immediately.

   @Test
    public void testWaitForCondition(){
        useTelluriumEngine(false);
        jlm.waitForCondition("try {var doc
=selenium.browserbot.getCurrentWindow(true).document;doc.readyState
=='incomplete'}catch(err){false}", 10000);
        jlm.waitForCondition("selenium.getText(\"//inp...@type='text' and
@name='j_username']\")=='Tellurium", 10000);
        useTelluriumEngine(true);
        jlm.waitForCondition("try {var doc
=selenium.browserbot.getCurrentWindow(true).document;doc.readyState
=='incomplete'}catch(err){false}", 10000);
        jlm.waitForCondition("selenium.getText(\"//inp...@type='text' and
@name='j_username']\")=='Tellurium", 10000);
        jlm.logon("tellurium", "source");
    }

Result:

TE: Name: waitForCondition, start: 1265922636902, duration: 25ms
TE: Name: waitForCondition, start: 1265922636929, duration: 24ms

It is strange since Tellurium new API does not handle the waitForCondition
command and simply delegates it to selenium core. This behavior is proved by
the fact that it returns immediately no matter whether I use Tellurium
Engine or not.

What was the last time your code worked fine with the waitForCondition
command? i.e., with 0.6.0 or what version of 0.7.0 SNAPSHOT?

Thanks,

Jian


On Thu, Feb 11, 2010 at 9:47 AM, Jian Fang <[email protected]> wrote:

> I will look into the first waitForCondition problem. It might be related to
> the bundle tier.
> Could you put a command
>
> pause(100)
>
> after the waitForCondition to see if you can work around this problem?
>
> For the custom method, new Tellurium API provides a method for users to
> register
> the custom method since I don't like Selenium core API name conversion.
>
>
> Tellurium.prototype.registerApi = function(apiName, requireElement,
> returnType)
>
> where apiName is the method name, requireElement means it requires a
> locator. The returnType
> is defined by the enum in core
>
> public enum ReturnType {
>   VOID,
>   NUMBER,
>   STRING,
>   BOOLEAN,
>   ARRAY,
>   MAP,
>   OBJECT
> }
>
> For example, you can register a custom method as follows,
>
> teJQuery(document).ready(function() {
>     tellurium.registerApi("getUiByTag", false, "ARRAY");
> });
>
> Also, are you sure that you are using custom selenium server snapshot
> 1.0.1-te2-SNAPSHOT?
>
> tellurium.js<http://localhost:4444/selenium-server/core/scripts/tellurium.js>,
> lineNumber -> 957,
> does not point to the statement
>
> selenium[apiName]
>
> in trunk/engine any more.
>
> Thanks,
>
> Jian
>
>
> On Thu, Feb 11, 2010 at 5:53 AM, dominicm <[email protected]>wrote:
>
>> Hi,
>>
>> I think there is a problem with the latest build when using selenium
>> waitForCondition.
>>
>> e.g. from Selenium log window
>> nfo(1265883357685): Executing: |getBundleResponse | [{"uid":"","args":
>> ["selenium.browserbot.getCurrentWindow().betfair.User.getLoginState()===
>> 'loggedOut'","60000"],"name":"waitForCondition","sequ":64}] | |
>>
>> Does not actually wiat for the statement to eval to true, instead it
>> appears to call once and proceed irrespective of the result, so when I
>> change the script so that it will allways return false, it still runs
>> once and proceeds.
>>
>> info(1265884649685): Executing: |getBundleResponse | [{"uid":"","args":
>> ["selenium.browserbot.getCurrentWindow().betfair.User.getLoginState()===
>> 'loggedOut1'","10000"],"name":"waitForCondition","sequ":25}] | |
>>
>> A more generic Javascript that you could use to test would be
>>
>> waitForCondition("try {var doc =
>> selenium.browserbot.getCurrentWindow(true).document;doc.readyState ==
>> 'complete'}catch(err){false}")
>>
>> If you change 'complete' to anything else it will not error or timeout
>> as it should. I suspect this is happening with more or less anything
>> that uses selenium's timeout functionality.
>>
>> Also there is a problem with user extensions. e.g. my custom jQuery
>> click method (not needed any more I know, but does illustrate the
>> point).
>>
>> # info(1265885104194): Executing: |getBundleResponse |
>> [{"uid":"account.loginMessages.membershipNumberLink","args":
>>
>> ["jquery=#customerNumberLinkText"],"name":"waitForElementVisibleJQ","sequ":
>> 43}] | |
>> # error(1265885104194): Unexpected Exception: selenium[apiName] is
>> undefined
>> # error(1265885104195): Exception details: message ->
>> selenium[apiName] is undefined, fileName ->
>> http://localhost:4444/selenium-server/core/scripts/tellurium.js,
>> lineNumber -> 957, stack -> ([object Object],[object Object])@http://
>> localhost:4444/selenium-server/core/scripts/tellurium.js:957 ()@http://
>> localhost:4444/selenium-server/core/scripts/tellurium.js:911 ("[{\"uid
>> \":\"account.loginMessages.membershipNumberLink\",\"args\":
>> [\"jquery=#customerNumberLinkText\"],\"name\":\"waitForElementVisibleJQ
>> \",\"sequ\":43}]","")@http://localhost:4444/selenium-server/core/
>> scripts/tellurium-extensions.js:337<http://localhost:4444/selenium-server/core/%0Ascripts/tellurium-extensions.js:337>("[{\"uid\":
>> \"account.loginMessages.membershipNumberLink\",\"args\":
>> [\"jquery=#customerNumberLinkText\"],\"name\":\"waitForElementVisibleJQ
>> \",\"sequ\":43}]","")@http://localhost:4444/selenium-server/core/
>> scripts/htmlutils.js:60<http://localhost:4444/selenium-server/core/%0Ascripts/htmlutils.js:60>([object
>>  Object],[object Object])@http://
>> localhost:4444/selenium-server/core/scripts/selenium-
>> commandhandlers.js:330 ()@http://localhost:4444/selenium-server/core/
>> scripts/selenium-executionloop.js:112<http://localhost:4444/selenium-server/core/%0Ascripts/selenium-executionloop.js:112>(-10)@
>> http://localhost:4444/
>> selenium-server/core/scripts/selenium-executionloop.js:78<http://localhost:4444/%0Aselenium-server/core/scripts/selenium-executionloop.js:78>(-10)@http://
>> localhost:4444/selenium-server/core/scripts/htmlutils.js:60 , name ->
>> TypeError
>>
>> I suspect that the two problems are related.
>>
>> --
>> 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.

Reply via email to