views:

77

answers:

1

Hi,

I have a test where I have to check that when a particular item is selected on a web page, the item is loaded into a flash object on the same page. This being done via Javascript. I have to check whether the parameters being passed to flash by Javascript are correct(i.e. the right item is being passed to flash). The only way I can imagine as of now is to intercept these javascript functions and somehow read their parameters. Can anyone suggest how to do this? You can suggest other workarounds too...

+1  A: 

Assuming that you have a JavaScript object, in this case called Foobar, that does the call to your Flash app you can do something along these lines.

selenium.RunScript(@"var foo = new Foobar();
                   foo.oldBlah = foo.blah;
                   foo.blah = function(){
                      // run some code to do the checks maybe putting into a global Javascript variable
                      foo.oldBlah();
                   };");
selenium.GetEval("var win = this.browserbot.getUserWindow(); return win.globalVarCreatedAbove");

I haven't tested this but hopefully you get the gist of that I am trying to do.

AutomatedTester