Winium.Desktop icon indicating copy to clipboard operation
Winium.Desktop copied to clipboard

WiniumDriverService is not working

Open sampadrout opened this issue 8 years ago • 27 comments

I have following code: @Test public void setup () { DesktopOptions options = new DesktopOptions(); options.setApplicationPath("C:\Windows\System32\notepad.exe");

    WiniumDriverService service = new WiniumDriverService.Builder()
            .usingDriverExecutable(new File("C:\\Winium.Desktop.Driver.exe"))
            .usingAnyFreePort()
            .withVerbose(true)
            .withSilent(false)
            .buildDesktopService();
    WiniumDriver driver = new WiniumDriver(service, options);

When i am trying to run it using TestNG, getting below error. Please help. Starting Windows Desktop Driver on port 9999

17:07:46 [ERROR] SocketException occurred while trying to start listner: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() 17:07:46 [FATAL] Failed to start driver: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args) May 28, 2016 5:08:05 PM org.openqa.selenium.os.UnixProcess checkForError SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: -532462766 (Exit value: -532462766) FAILED: setup

sampadrout avatar May 28 '16 11:05 sampadrout

@sampadrout Hi, may I help you now?

skyline-gleb avatar Sep 21 '16 08:09 skyline-gleb

@iddanaj in other thread we came to the decision to launch the driver manually, so reliable. But if you want to use usingDriverExecutable, needed check (using debug) waht driver not launch twice - error just in this

skyline-gleb avatar Sep 30 '16 05:09 skyline-gleb

For what it's worth... I find that

  1. using ".usingAnyFreePort()" isn't that great. For me I use ".usingPort(9999)" instead.
  2. the WiniumDriverService instance need to be started before the associated driver can use it. For example, service.start()
  3. service.stop() doesn't work. :-(

Hope this helps.

mikeliucc avatar Oct 14 '16 07:10 mikeliucc

Ok, thanks

skyline-gleb avatar Oct 17 '16 01:10 skyline-gleb

Hi ,

Were you able to resolve this issue? , i am getting similar issue and not even able to start the winiumdriver manually, can anyone help me with this?

smrtyviks avatar Feb 01 '17 11:02 smrtyviks

Hello, I assume your are getting the following exception:

Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at Winium.Desktop.Driver.Listener.StartListening()
at Winium.Desktop.Driver.Program.Main(String[] args)

It means that some other process is already listening to port 9999, so the driver can not bind to this port. To see if any process is listening to the port 9999 you can use following powershell command:

Get-NetTCPConnection -LocalPort 9999

If there is any process already listening to 9999, then you have to options: Kill the process and free the port, so that driver can bind to 9999 Start the driver on a different port using --port option, e.g. Winium.Desktop.Driver.exe --port 9000

NickAb avatar Feb 02 '17 01:02 NickAb

I Tried these options but still not able to execute my test and the code looks as mentioned below:

public class SkatNova1 {

static WiniumDriver driver = null;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
DesktopOptions options=new DesktopOptions();
options.setApplicationPath("C:\\Program Files (x86)\\Wolters Kluwer\\Skat Nova 2016\\SkatNova16.exe");

try{
	driver= new WiniumDriver(new URL("http://loclahost:4444"),options);
}catch(MalformedURLException e){
	e.printStackTrace();
}
}

@AfterClass
public static void tearDownAfterClass() throws Exception {
	driver.close();
}

@Test
public void test() {
	WebElement skatnovamain=driver.findElementByClassName("TSkMainForm");
	WebElement Bruggerinfo=driver.findElementByClassName("TCustomerInfoForm");
	
	Bruggerinfo.findElement(By.id("135564")).click();
	
	
}

}

smrtyviks avatar Feb 05 '17 18:02 smrtyviks

I think you got a typo in driver url.

It should be "http://localhost:4444, not "http://loclahost:4444

NickAb avatar Feb 06 '17 01:02 NickAb

I also have this issue.. Do you have any resolution for this

Sourabh25 avatar Mar 28 '17 16:03 Sourabh25

@skyline-gleb We are trying to automate Calc application using Winium Driver but in my case connection getting closed after 1 click action performed.

Java Code: https://gist.github.com/jaspreet07/3cf118a794dd6d7759e374c974859981

Console Output : https://gist.github.com/jaspreet07/b6b10af1b8365168bdc3b6992c616319

Please let me know If I am missing anything.

Thanks in Advance : J

Note: Before running Winium Code I have to kill process id of task running on port 9999.

netstat -ano | find "9999" taskkill /F /PID 7296 (ProcessId of port 9999 running on my machine)

As Service.Stop() not working.

jaspreet07 avatar May 07 '17 05:05 jaspreet07

Is there update to this question? Ideally the driver should be allowed to launch twice. Launching it twice just by double clicking .exe also displays same error as @sampadrout pointed out.

Bala810R avatar Jun 28 '17 21:06 Bala810R

Hi , I am getting same issue and not even able to start the winiumdriver manually, can anyone help me with this? Please see screenshot attached below.

winiumdesktopdrivererror

Rajeshwarb avatar Feb 23 '18 00:02 Rajeshwarb

I also have same issue.. "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:9999 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.MakeHttpRequest(HttpRequestInfo requestInfo) at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)' " if anyone got solution please help me out

sheikhsamina avatar Jul 03 '18 10:07 sheikhsamina

believe you dont have admin persmission to bind a port . the error message clearly shows An attempt was made to access a socket in a way forbidden by its access permissions'. says that you dont have persmission to open the port. Check with your it team thet might give you access. Check the same on your personal laptop hope it works

contactkkiran avatar Jul 11 '18 06:07 contactkkiran

Facing the same issue, here i have attached the screenshot. kindly suggest me how to overcome this issue. Thanks in advance.

winium driver runtime error

shivakchepyala avatar Aug 06 '18 16:08 shivakchepyala

Hello everyone,

Even I am facing the same issue as mentioned by @shivakchepyala above. Any leads on how to solve this issue with Winium will be of immense help guys.

PFB the error snippet from console: [ERROR] SocketException occurred while trying to start listner: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted

Thanks, Krishanu

krishanuc1001 avatar Aug 18 '18 08:08 krishanuc1001

Here is a working sample on Windows 7 x64 - https://gist.github.com/psychsane/bb9dd24135f4957c7631441c0999195d

Make sure no Winium services are running - image

sailfishdev avatar Sep 19 '18 06:09 sailfishdev

Hi ,

You can even work with out launching from command prompt you can specify the .exe with in your code. PFA the Java Class file which has the below code you may need to quit use service.stop else you may need to kill the port specified

public class WiniumUsage { static WiniumDriver driver = null; static WiniumDriverService service = null;

public static void main(String[] args) throws MalformedURLException { // TODO Auto-generated method stub System.setProperty( "webdriver.winium.driver.desktop", "C:\Users\kkanumuri\Downloads\Winium.Desktop.Driver\Winium.Desktop.Driver.exe"); DesktopOptions options = new DesktopOptions(); options.setApplicationPath("C:\Windows\System32\notepad.exe");

File driverPath = new File( "C:\Users\kkanumuri\Downloads\Winium.Desktop.Driver\Winium.Desktop.Driver.exe"); service = new WiniumDriverService.Builder() .usingDriverExecutable(driverPath).usingPort(9999) .withVerbose(true).withSilent(false).buildDesktopService();

driver = new WiniumDriver(service, options); try { service.start(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

Thanks, Kiran

On Mon, Aug 6, 2018 at 9:46 PM Shiva Krishna Chepyala < [email protected]> wrote:

Facing the same issue, here i have attached the screenshot. kindly suggest me [image: winium driver runtime error] https://user-images.githubusercontent.com/8750365/43728249-1bda6a90-99c2-11e8-9977-82ef0cfa2ca9.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/2gis/Winium.Desktop/issues/105#issuecomment-410763968, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA0a8QUYwvV3SHvPCJRXCXB4er--Apyks5uOGvNgaJpZM4IpDrc .

contactkkiran avatar Oct 07 '18 22:10 contactkkiran

I am also getting the same error. Above suggestions doesnt seems to work. Any fix for this ?

singhbrijyot91 avatar Oct 25 '18 11:10 singhbrijyot91

Are you trying to mauanlly launch Desktop driver manually . avoid launching manally instead do it silent launching from code. The code in this reply you can find how to lauch driver.exe from code

Thanks, Kiran

On Thu, Oct 25, 2018 at 5:04 PM singhbrijyot91 [email protected] wrote:

I am also getting the same error. Above suggestions doesnt seems to work. Any fix for this ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/2gis/Winium.Desktop/issues/105#issuecomment-433016587, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA0a61At5dnC6pgKOL5Jxt7FItl93c_ks5uoaHEgaJpZM4IpDrc .

contactkkiran avatar Oct 25 '18 16:10 contactkkiran

I am using the same code as above, but still getting the error.

System.setProperty("webdriver.winium.driver.desktop", 
  "J:\\workspace\\behaviourFin\\Winium.Desktop.Driver.exe");
DesktopOptions options=new DesktopOptions();
options.setApplicationPath("C:\\Users\\A621934\\FMW\\MyApp.exe");

File driverPath=new File("J:\\workspace\\behaviourFin\\Winium.Desktop.Driver.exe");
WiniumDriverService service=new 
   WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999).
   withVerbose(true).withSilent(false).buildDesktopService();
   WiniumDriver driver=new WiniumDriver(service,options);

This is giving me the same error : Starting Windows Desktop Driver on port 9999

09:44:38 [ERROR] SocketException occurred while trying to start listner: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() 09:44:38 [FATAL] Failed to start driver: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

singhbrijyot91 avatar Oct 26 '18 04:10 singhbrijyot91

Hmm , looking at your logs should have admin permission to unblock the port .you may contect your system admin to unblock the port . This should work for sure

Thanks, Kiran

On Fri, 26 Oct 2018 at 09:47, singhbrijyot91 [email protected] wrote:

I am using the same code as above, but still getting the error.

System.setProperty("webdriver.winium.driver.desktop", "J:\workspace\behaviourFin\Winium.Desktop.Driver.exe"); DesktopOptions options=new DesktopOptions(); options.setApplicationPath("C:\Users\A621934\FMW\MyApp.exe");

File driverPath=new File("J:\workspace\behaviourFin\Winium.Desktop.Driver.exe"); WiniumDriverService service=new WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999). withVerbose(true).withSilent(false).buildDesktopService(); WiniumDriver driver=new WiniumDriver(service,options);

This is giving me the same error : Starting Windows Desktop Driver on port 9999

09:44:38 [ERROR] SocketException occurred while trying to start listner: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() 09:44:38 [FATAL] Failed to start driver: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/2gis/Winium.Desktop/issues/105#issuecomment-433281245, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA0axn_udJOQw614eemk1W72agLztgDks5uoozegaJpZM4IpDrc .

-- Sent from my Iphone

contactkkiran avatar Oct 26 '18 10:10 contactkkiran

Here you got to task manager and kill the process winium.desktop.driver it will work. one port will handle only 1 service.

also add the below line in your @aftersuit - service.stop() so that even if your test fails it will stop the service so that you don't need to do it manually every time

ankurb9 avatar Nov 19 '18 06:11 ankurb9

Hi, the winium development is almost stopped and the last build was sep'16. Please move to WinAppDriver managed by microsoft for desktop based app automation. Thanks.

sampadrout avatar Nov 19 '18 06:11 sampadrout

Log "*Only one usage of each socket address (protocol/network address/port) is normally permitted"*clearly shows the port is blocked by your IT team ask then unblock the port and try

Thanks, Kiran

On Fri, 26 Oct 2018 at 09:47, singhbrijyot91 [email protected] wrote:

I am using the same code as above, but still getting the error.

System.setProperty("webdriver.winium.driver.desktop", "J:\workspace\behaviourFin\Winium.Desktop.Driver.exe"); DesktopOptions options=new DesktopOptions(); options.setApplicationPath("C:\Users\A621934\FMW\MyApp.exe");

File driverPath=new File("J:\workspace\behaviourFin\Winium.Desktop.Driver.exe"); WiniumDriverService service=new WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999). withVerbose(true).withSilent(false).buildDesktopService(); WiniumDriver driver=new WiniumDriver(service,options);

This is giving me the same error : Starting Windows Desktop Driver on port 9999

09:44:38 [ERROR] SocketException occurred while trying to start listner: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() 09:44:38 [FATAL] Failed to start driver: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/2gis/Winium.Desktop/issues/105#issuecomment-433281245, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA0axn_udJOQw614eemk1W72agLztgDks5uoozegaJpZM4IpDrc .

contactkkiran avatar Nov 19 '18 15:11 contactkkiran

Log "*Only one usage of each socket address (protocol/network address/port) is normally permitted"*clearly shows the port is blocked by your IT team .Ask them to unblock the port or ask then to provide admin permission and try everything good to go

On Fri, Oct 26, 2018 at 9:47 AM singhbrijyot91 [email protected] wrote:

I am using the same code as above, but still getting the error.

System.setProperty("webdriver.winium.driver.desktop", "J:\workspace\behaviourFin\Winium.Desktop.Driver.exe"); DesktopOptions options=new DesktopOptions(); options.setApplicationPath("C:\Users\A621934\FMW\MyApp.exe");

File driverPath=new File("J:\workspace\behaviourFin\Winium.Desktop.Driver.exe"); WiniumDriverService service=new WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999). withVerbose(true).withSilent(false).buildDesktopService(); WiniumDriver driver=new WiniumDriver(service,options);

This is giving me the same error : Starting Windows Desktop Driver on port 9999

09:44:38 [ERROR] SocketException occurred while trying to start listner: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() 09:44:38 [FATAL] Failed to start driver: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

Unhandled Exception: System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at System.Net.Sockets.TcpListener.Start(Int32 backlog) at Winium.Desktop.Driver.Listener.StartListening() at Winium.Desktop.Driver.Program.Main(String[] args)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/2gis/Winium.Desktop/issues/105#issuecomment-433281245, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA0axn_udJOQw614eemk1W72agLztgDks5uoozegaJpZM4IpDrc .

contactkkiran avatar Nov 19 '18 15:11 contactkkiran

Process process = Runtime.getRuntime().exec("TASKKILL /F /IM Winium.Desktop.Driver.exe"); process.waitFor(); if(process.isAlive()) { process.destroy(); }

Place the above code before creating WiniumDriverService. Then we can free from error popup.

cnr465 avatar Jun 04 '19 08:06 cnr465