Skip to content

Instantly share code, notes, and snippets.

View RossPatterson's full-sized avatar

Ross Patterson RossPatterson

  • 04:43 (UTC -05:00)
View GitHub Profile
public static void FillTinyMCE(P5Browser selenium, string editorId, string fillString)
{
string editorFrameId = editorId + "_ifr";
selenium.Focus(String.Format("dom=document.getElementById('{0}').contentWindow.document.body", editorFrameId));
selenium.GetEval(String.Format("selenium.browserbot.getCurrentWindow().document.getElementById('{0}').contentWindow.document.body.innerHTML = '{1}';",
editorFrameId, fillString.ToJsString('\'')));
}
@RossPatterson
RossPatterson / ShouldFindOneErrorInBadScript.cs
Created May 4, 2012 18:53
Changes to add support for capturing JavaScript errors and treating them similar to alerts - the test script must retrieve them right after they occur, or an exception is thrown.
/// <summary>
/// Make sure our IsJavaScriptErrorPresent() and GetJavaScriptError() extensions can correctly intercept an error.
/// </summary>
[Test]
public void ShouldFindOneErrorInBadScript()
{
selenium.Open("http://localhost");
selenium.RunScript("window.ThereBetterNotBeAFunctionByThisName();");
// The error should be:
// window.ThereBetterNotBeAFunctionByThisName is not a function at http://localhost/ics/support/myhistory.asp line 0
@RossPatterson
RossPatterson / RandomData.cs
Created January 30, 2012 19:46
RandomData generator in C#
#undef UNIT_TESTS
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
#if UNIT_TESTS
using System.Text.RegularExpressions;
using NUnit.Framework;
#endif