Ok,

What happens if you, manually, type in "new value" in the field (only
the text, don't press enter, dont click etc)??

My guess is nothing (unless you've added your own keyboard event
handlers). And this is what your selenium test does.

If so take a look here
http://www.eviltester.com/index.php/2009/01/24/how-i-learned-to-love-seleniums-fireevent/

I think you need to add something like this to the test to trigger the
ajax call:

selSession.fireEvent("edit_field_1", "blur");

/Jeppe

On Wed, Mar 3, 2010 at 12:48 PM, Tweek <d.sztwio...@gmail.com> wrote:
> okej, so:
> i've got code like this:
>
> var testStr : String = ""
>
> def set(s : String) : JsCmd ={
> println(s)
> testStr = s
> JsRaw("")
> }
>
> def render(ns : NodeSeq) : NodeSeq ={
> bind("fields", ns,
> "name" -> SHtml.ajaxText(testStr, (s : String) => setName(s) ) % ("id"
> -> "name"),
> ...
> }
>
> and JUnit test with Selenium like this:
>
> class FirstSeleniumTest extends SeleneseTestCase  {
>    //   �...@before
>    override def setUp: Unit = {
>        super.setUp("http://localhost:8080/";, "*firefox")
>        selenium.windowMaximize()
>    }
>    //   �...@after
>    override def tearDown: Unit = {
>       selenium.close
>    }
>    //   �...@test
>    def testFirst = {
>    selenium.open("/")
>    selenium.waitForPageToLoad("30000")
>    selenium.`type`("name","new value")
>    ...
>    }
> }
>
> finally i'm running it from maven by: mvn test -
> Dtest=FirstSeleniumTest (jetty is running in other console)
>
> all of this is looking fine, selenium is working, "new value" is put
> in my ajaxText field, but the setName function is not call - i'm not
> get any log in console where jetty is running
>
> On 3 Mar, 10:40, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:
>> On Wed, Mar 3, 2010 at 10:30 AM, Tweek <d.sztwio...@gmail.com> wrote:
>> > Hi,
>>
>> > I'm writting Selenium tests with Scala JUnit.
>>
>> > The problem is when i try to put value in SHtml.ajaxText field.
>> > Selenium RC doesn't call my js function from this ajaxText.
>>
>> Not sure exactly what you mean by the above, but IIRC, the ajax
>> request is not triggered by simply setting a value in a field but when
>> you exit the field (onBlur).
>>
>> Also note that the fields usually get a unique id for each new page
>> view. To get stable identifiers you should run in test mode (see the
>> list for details)
>>
>> I'll be interested in your results as we probably have to do something
>> similar soon :-)
>>
>> /Jeppe
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Lift" group.
> To post to this group, send email to lift...@googlegroups.com.
> To unsubscribe from this group, send email to 
> liftweb+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/liftweb?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to