Open sirj77 opened 9 years ago
Hi @sirj77,
You could do something like this:
namespace Name_ofProject
{
public static class Host
{
public static readonly SelenoHost Instance = new SelenoHost();
static Host()
{
// create the Firefox instance
string xpiDir = ... the directory where the file JSErrorCollector.xpi is ....;
FirefoxProfile ffProfile = new FirefoxProfile();
JavaScriptError.AddExtension(ffProfile, xpiDir);
IWebDriver wd = new FirefoxDriver(ffProfile);
Instance.Run(configure => configure
.WithWebServer(new InternetWebServer("test_url"))
.WithRemoteWebDriver(wd));
}
}
}
Then use the jsErrors
wherever you need to make the assertion: perhaps in one of your Then steps.
Hi,
Could someone help me with putting some piece of code into Seleno? I need to catch javascript errors on the Home page at least. I found a good solution - JSErrorCollector. Below you can see some implementation of this:
How and where in my test or settings I can put it and then use it in my tests? My test looks like this: