On 28 October 2010 01:54, Ian Booth <[email protected]> wrote: > Hi > > I just wanted to share a problem that I got snagged on in case anyone > else comes across the same thing. The issue affects Windmill tests and > causes them to error with a client timeout exception. For me, it only > started happening recently when I wrote a new test but around the same > time also showed up on ec2 for other existing tests that I didn't write. > > When writing a Windmill test, you can wait for a page element like a > button to appear so you know the page is loaded, before moving on to the > next step in the test. This can be done like so: > > ADD_COMMENT_BUTTON = ( > u'//inp...@id="field.actions.save" and contains(@class, "button")]' > client.waits.forElement(xpath=ADD_COMMENT_BUTTON)
I think contains(...) matches any substring, so the expression above will match classes like "big-red-button" too. Probably not something to worry about much, but it /might/ lead to difficult to diagnose bugs. I don't know if we have a new enough Windmill, but the documentation (http://github.com/windmill/windmill/wiki/Controller-API) talks about using jquery selectors (i.e. CSS selectors). If it is available its use could help side-step that small issue: client.waits.forElement( jquery=u'("input.button#field.actions.save")') Gavin. _______________________________________________ Mailing list: https://launchpad.net/~launchpad-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~launchpad-dev More help : https://help.launchpad.net/ListHelp

