Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # From FlashSelenium ruby driver
- def flash_call(flashObjectId, functionName, *parameters)
- within_facebook_canvas_iframe {
- return page.evaluate_script(jsForFunction(flashObjectId, functionName, *parameters))
- }
- end
- def checkBrowserAndReturnJSPrefix(flashObjectId)
- ret = "document['#{flashObjectId}'].swf_element_ref."
- # Fix for IE
- indexOfMicrosoft = page.evaluate_script("navigator.appName.indexOf(\"Microsoft Internet\")")
- ret = "window." + ret if (indexOfMicrosoft != -1)
- return ret
- end
- def jsForFunction(flashObjectId, functionName, *args)
- @flashJSStringPrefix = checkBrowserAndReturnJSPrefix(flashObjectId)
- functionArgs = ""
- if args.empty?
- return @flashJSStringPrefix + functionName + "();"
- end
- args.each do | arg |
- functionArgs = functionArgs + "'" + arg.to_s + "',"
- end
- functionArgs = functionArgs[0..(functionArgs.length - 2)]
- return @flashJSStringPrefix + functionName + "(" + functionArgs + ");"
- end
Add Comment
Please, Sign In to add comment