On Fri, 09 Oct 2009, tyler@... wrote:
> As most folks at Slide are used to Python, I added came up with this
> IronPython-based runner which we've started to use internally:
> http://github.com/rtyler/IronWatin
>
> I'd love any feedback you all have on using WatiN outside of a strictly
> C#/VB.NET context.
Hello again, I figured I would send this update for anybody
contemplating working with IronWatin in the future, I've implemented
screen capturing capabilities to help record what's going on when
IronWatin/WatiN is running :)
Currently IronWatin[1] will only capture a series of GIFs, I've not yet
put together the capability to lace them together into an animation (but
I do want to!).
Take the following sample test (sample.py):
import IronWatin
import WatiN.Core as Watin
class SampleTest(IronWatin.BrowserTest):
url = 'http://yahoo.com'
@IronWatin.record(prefix='SampleTest')
def runTest(self):
self.browser.Element(Watin.Find.ByName('p')).WaitUntilExists()
self.browser.Element(Watin.Find.ByName('p')).Click()
self.browser.TextField(Watin.Find.ByName('p')).TypeText('IronWatin FTW')
if __name__ == '__main__':
IronWatin.main()
When sample.py is run, the function "runTest" with the decorator
(attribute in .NET parlance) will insert a trace function causing a
screenshot to be captured after every line in the function, resulting in
SampleTest_0.gif, SampleTest_1.gif, SampleTest_2.gif and
SampleTest_3.gif in the current working directory.
Additionally, if you don't require a series of screenshots in this
fashion, you can use `IronWatin.captureScreenshot(string filename)` to
programmatically capture a screenshot at any point while executing an
IronWatin test.
If you're curious how this is implemented, see my commit [2] to
IronWatin.
I hope you can find IronWatin as useful as adam@ and I are, enjoy :)
Cheers,
-R. Tyler Ballance
--------------------------------------
GitHub: http://github.com/rtyler
Twitter: http://twitter.com/agentdero
Blog: http://unethicalblogger.com
[1] http://github.com/rtyler/IronWatin/
[2] http://github.com/rtyler/IronWatin/commit/85f4117f339203c820f2bc5fa5bbed8b4b66ca71
|