Mattyfog
24-05-2010, 18:10
Salve a tutti, dovrei eseguire l'override di un metodo della dll si Watin.
Il codice della dll che ci interessa è questo:
namespace WatiN.Core
{
public class FireFox : Browser
{
private static string GetExecutablePath()
{
string path;
var mozillaKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mozilla\Mozilla Firefox");
if (mozillaKey != null)
{
path = GetExecutablePathUsingRegistry(mozillaKey);
}
else
{
// We try and guess common locations where FireFox might be installed
var tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Mozilla FireFox\FireFox.exe");
if (File.Exists(tempPath))
{
path = tempPath;
}
else
{
tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + " (x86)", @"Mozilla FireFox\FireFox.exe");
if (File.Exists(tempPath))
{
path = tempPath;
}
else
{
throw new FireFoxException("Unable to determine the current version of FireFox tried looking in the registry and the common locations on disk, please make sure you have installed FireFox and Jssh correctly");
}
}
}
return path;
}
}
Io ho tentato di eseguire l'override così:
public class MyWatiN : WatiN.Core.FireFox
{
public override string GetExecutablePath()
{
string path = @"Firefox Portable\App\firefox\firefox.exe";
return path;
}
}
Ma in fase di compilazione ho un errore:
'NomeProgetto.MyWatiN.GetExecutablePath()': impossibile trovare un metodo adeguato per eseguire l'override
Cosa sbaglio?
Il codice della dll che ci interessa è questo:
namespace WatiN.Core
{
public class FireFox : Browser
{
private static string GetExecutablePath()
{
string path;
var mozillaKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mozilla\Mozilla Firefox");
if (mozillaKey != null)
{
path = GetExecutablePathUsingRegistry(mozillaKey);
}
else
{
// We try and guess common locations where FireFox might be installed
var tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Mozilla FireFox\FireFox.exe");
if (File.Exists(tempPath))
{
path = tempPath;
}
else
{
tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + " (x86)", @"Mozilla FireFox\FireFox.exe");
if (File.Exists(tempPath))
{
path = tempPath;
}
else
{
throw new FireFoxException("Unable to determine the current version of FireFox tried looking in the registry and the common locations on disk, please make sure you have installed FireFox and Jssh correctly");
}
}
}
return path;
}
}
Io ho tentato di eseguire l'override così:
public class MyWatiN : WatiN.Core.FireFox
{
public override string GetExecutablePath()
{
string path = @"Firefox Portable\App\firefox\firefox.exe";
return path;
}
}
Ma in fase di compilazione ho un errore:
'NomeProgetto.MyWatiN.GetExecutablePath()': impossibile trovare un metodo adeguato per eseguire l'override
Cosa sbaglio?