tags:

views:

786

answers:

4

Hi All, I am just experimenting WatiN unit testing tool for Asp.Net application.. And my pages are designed with huge & complex list of own custom controls .. And its very difficult for us to identify the elements within these control (for ex: to select the row in our custom grid based on some business rules is very tough)..

so avoid this, i have planned to write all my test stubs in seperate Javascript library.. and call them from WatiN..(ex: A method which done some business validation on the grid and will select the partuiclar row, and i need to call this method from WatIn).. I have actually implemented this approach but am getting Access violation error while calling the javascript method from Eval or Runscript method in WatIn..

Am not sure whether this is possible in WatIn..?? can someone clarify me??

Cheers, Ramesh Vel

A: 

Hi Ramesh, The RunScript method within WatiN has little room for reply. If the script you want to run contains an error of any kind, WatiN will throw the AV exception (this should definitely be improved). It is possible to do what you want-- I did the same thing with Infragistics grid controls.

Sorry I couldn't be of more help.

Daaron
A: 

Thanks Daaron, i appreciate ur reply..but i think the method which i called in page javascript is working fine when i call it in the context of IE(not from watio).. i ve been trying to get a workaround for this.. but nothing positive...

I need one more clarification.. do i need to setup any access rights for watiN test app since it throws access violation while calling the script outside from IE context..?

Cheers

Ramesh Vel

A: 

You call the DomContainer.Eval method.

Bruce McLeod
A: 

I had similar problems with WatiN and had to add a number of extra methods that accessed directly the IE Browser Object to make this happen.

See theO2 API/WatiN page for more details and specially the video http://www.youtube.com/watch?v=YsVX5-nGHWI which shows the html/javacript injection in action.

You might also be interrested in the javacript parser integration that I added to the O2 Platform using the [Jint API][3] (see http://www.youtube.com/watch?v=_pqY_6-P-xU for an example of what I did with it)

[3]: http://www.o2platform.com/index.php/O2 API/Jint

Dinis Cruz