We have an application in which we use the Selenium test environment. The application runs on Windows Server 2012 and runs regularly through the Windows Task Scheduler. I connect to the server through Remote Desktop.
The problem occurs when I set the settings for the scheduled task "Run whether the user was turned on or not." My application starts working normally with this javascript code, but then it immediately ends with an exception error - it is marked in the line below. If I run the application normally, everything works fine. Unfortunately, I need to create an application that can work even if no one is logged in. Has no one encountered this problem?
This is my code:
public Bitmap MakeBitmap(Uri url)
{
driver = MakeFirefoxDriver();
driver.Navigate().GoToUrl(url.AbsoluteUri);
driver.ExecuteScript("document.body.style.overflow = 'hidden'")
Thread.Sleep(TimeSpan.FromSeconds(SleepTime));
var screenshot = driver.GetScreenshot();
return new Bitmap(Image.FromStream(new MemoryStream(screenshot.AsByteArray)));
}
private FirefoxDriver MakeFirefoxDriver()
{
var profile = new FirefoxProfile { EnableNativeEvents = true };
var capabilityValue = new List<string> { "-width", "500", "-height", "340" };
var capabilities = DesiredCapabilities.Firefox();
capabilities.SetCapability("initial", capabilityValue);
capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile);
return new FirefoxDriver(capabilities);
}
:
Exception log: No response from server for url http:
StackTrace: at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest
request) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String
driverCommandToExecute, Dictionary`2 parameters) at ...