I have a problem with my selenium test, when I try to run nothing happens and after 5 seconds it stopped, when i try to debug it, there appears error: enter image description here
And this is full error message:
OpenQA.Selenium.WebDriverException: 'Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:5566
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
at System.Net.HttpWebRequest.GetRequestStream()
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)'
What does it means "no connection because machine actively refused it 127.0.0.1:5566", how it is possible to change this connection, if it is necessary and how I can find right connection?
A piece of code where it is an error:
namespace DVSTesti.Common
{
public class CustomRemoteWebDriver : RemoteWebDriver
{
public static bool useExistingSession = false;
public static string sessiodIdPath = String.Format(@"{0}\..\..\sessionID.txt", AppDomain.CurrentDomain.BaseDirectory);
public CustomRemoteWebDriver(Uri remoteAddress, DesiredCapabilities dd)
: base(remoteAddress, dd)
{
}
protected override Response Execute(string driverCommandToExecute, System.Collections.Generic.Dictionary<string,object> parameters)
{
if (driverCommandToExecute == DriverCommand.NewSession)
return ProcessNewSessionAction(parameters);
else
return base.Execute(driverCommandToExecute, parameters);
}
private Response ProcessNewSessionAction(Dictionary<string, object> parameters)
{
useExistingSession = false;
if (useExistingSession)
{
var sidText = File.ReadAllText(sessiodIdPath);
return new Response
{
SessionId = sidText,
};
}
else
{
var response = base.Execute(DriverCommand.NewSession, parameters);
File.WriteAllText(sessiodIdPath, response.SessionId);
return response;
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire