Error when use StartWindowsPhoneDriver.cmd

May 5, 2015 at 1:11 PM
Hi all,

I'm trying to use Windows Phone Web Driver on a NOKIA Lumnia 925 (WP 8.1).
SDK is installed on my Windows 8 computer, WindowsPhoneDriver.xap application is deployed on my device and my phone is registered and connected to my computer.

When I launch StartWindowsPhoneDriver.cmd script, there is a error :
"Target dosen't have any interface allowing connection"

I've seen this problem in issues but there is no solution for me.

Have you any ideas please ?

Thank's in advance.

Regards,
May 5, 2015 at 3:56 PM
You could try to see if you would get it working with these instructions https://winphonewebdriver.codeplex.com/discussions/540305#post1417101.
May 5, 2015 at 4:02 PM
Thank's for your reply.

I've seen this experimental release. But i don't know how to use it. There is no ".exe" file. I don't know which file compile and how to compile them.

Could you help me to use it ?
May 5, 2015 at 4:21 PM
Sorry, i didn't see the experimental release of XAP file on the blog !
I try this now .

Thanks
May 5, 2015 at 4:26 PM
cgaulay wrote:
I've seen this experimental release. But i don't know how to use it. There is no ".exe" file. I don't know which file compile and how to compile them.
The .exe is the custom deployment tool that was required to deploy the earlier released version. With the experimental release, you do not need that.

Since you have the Windows Phone SDK installed, you should look into https://msdn.microsoft.com/en-us/library/windows/apps/ff402565%28v=vs.105%29.aspx?f=255&MSPPError=-2147217396#BKMK_device for instructions on deploying an app to your Lumia device. The file to deploy is the .xap found from the experimental release .zip archive.

After you have managed to start the app on your device, you could look into the example at http://blog.vjrantal.net/2015/02/05/angularjs-automated-testing-on-windows-phone/ to get an idea how one test framework can be configured to use that app as a remote WebDriver.

You don't necessarily have to compile anything yourself.
May 5, 2015 at 4:38 PM
Ok. It's just necessary to change the xap application on my device and execute DriverDeployTool.exe from stable release ?

Thanks
May 5, 2015 at 4:43 PM
cgaulay wrote:
Ok. It's just necessary to change the xap application on my device and execute DriverDeployTool.exe from stable release ?
No. With the experimental release, you do not use the DriverDeployTool.exe at all.

After you have deployed the app, run it on your device (manually) and configure your test runner to connect to that app.
May 5, 2015 at 4:48 PM
Seriously ? ! It's very nice !

I try this.

Thanks
May 6, 2015 at 8:10 AM
Hi,

I've installed the experimental release.
If i've understood, with this release, it's not possible to communicate with the device with "IP over USB" ?
Application it's connected to the wifi network and i have to be on the same network for communicate with him ?

This is not good for me ;)

Thanks.
May 6, 2015 at 10:29 AM
cgaulay wrote:
If i've understood, with this release, it's not possible to communicate with the device with "IP over USB" ?
That is right.
Application it's connected to the wifi network and i have to be on the same network for communicate with him ?
This is the main scenario for on-device testing. No WiFi network is required when testing on emulator.
This is not good for me ;)
If it is not possible to setup a WiFi network, would it help if the device would show the IP address of the mobile network interface? At least with some operators, it is possible to do HTTP requests towards the device also via this interface. The challenge with this one is that the IP may be changing often so one needs to be prepared to update the test runner to connect to the right IP.
May 6, 2015 at 10:38 AM
Yes. The problem for me is the tests will be executed on a technical network which hasn't any wifi access.

The solution with the previous app, IP over USB, was the best solution for me. But she doesn't work because of "Target doesn't have any interface allowing connection" .
What does it mean ?
There is no workaround for this issue ?
Can you explain me the problem ?

Thanks a lot for your help.
May 6, 2015 at 11:36 AM
cgaulay wrote:
The solution with the previous app, IP over USB, was the best solution for me. But she doesn't work because of "Target doesn't have any interface allowing connection" .
What does it mean ?
I can't say for sure what is the issue in your case to leverage the older solution, but I can explain how that one worked.

It did not use IP over USB (between the PC and mobile device) when executing the tests, but rather only the deployment and configuration of the driver was done over USB. The way that worked is that the deploy tool deployed the app (over USB) and waited for the app to write a specific file to its isolated storage. That file was then read from the PC (over USB) using the ISETool.exe. That tool works over USB.

However, as far as I know, the IP over USB implementation that the Windows Phone supports is not meant for a general purpose communication channel and thus not meant for app-specific HTTP communication. For example, this discussion https://social.msdn.microsoft.com/Forums/en-US/b916dd22-2d8c-4bbc-aff4-963dcf31de0f/how-to-get-ip-address-of-windows-phone-8-device-which-is-connected-to-pc-over-usb also addresses a similar topic.
May 6, 2015 at 11:45 AM
After I had written this, I got an idea what could be tried out to enable using the driver via USB. I'll post the results of the investigation here once I have verified this actually works.
May 7, 2015 at 6:53 PM
@Cgaulay - PreviousThe solution with the previous app, IP over USB, was the best solution for me. But she doesn't work because of "Target doesn't have any interface allowing connection"
Previous app only deal to deploy app and give IP message and doing exactly what VJ mentioned. You need wifi network for further communication to selenium.
May 11, 2015 at 8:43 AM
vjrantal wrote:
After I had written this, I got an idea what could be tried out to enable using the driver via USB. I'll post the results of the investigation here once I have verified this actually works.
Here is how to connect to the driver over USB:
  1. Have Windows Phone 8 SDK installed on your PC and a Windows Phone device connected via USB.
  2. Run following command:
c:\>"C:\Program Files (x86)\Common Files\Microsoft Shared\Phone Tools\CoreCon\11.0\bin\IpOverUsbEnum.exe"
  1. Make sure the output has something like this:
Partner:
  ...
Partner Services listening at ports:
  ...
  VSCodedUITestFramework 6621 -> 127.0.0.1:6621
  VSGraphicsRemoteEngine 8119 -> 127.0.0.1:8119
  VSUnitTestFramework 6620 -> 127.0.0.1:6620
  ...
  1. Take a note of the port mapping for VSCodedUITestFramework which in above case is "6621 -> 127.0.0.1:6621"
  2. Change the source code of the driver to listen on port 6621 and build/deploy the driver onto your device
  3. Connect the remote driver to 127.0.0.1:6621
Note that even if you connect to the driver over USB, you need a WiFi or other non-USB connection if you page under test is hosted on the PC to which the Windows Phone device is connected to.
May 11, 2015 at 8:57 AM
This solution works with stable driver or experimental driver ?
May 11, 2015 at 9:02 AM
cgaulay wrote:
This solution works with stable driver or experimental driver ?
You need to build the app yourself from https://winphonewebdriver.codeplex.com/SourceControl/network/forks/vjrantal/winphonewebdriver to be able to change the port. So overall, this isn't the easiest way to setup the driver.

The intent is that the user could change the port from the driver app's settings page, but this isn't currently possible.
May 11, 2015 at 9:59 AM
OK Thanks.

I'm not a developer. But i know Java. Unfortunately i don't know C# ! :(

But i'll try to do this solution
May 11, 2015 at 1:26 PM
When i run IpOverUsbEnum command, i don't have the same output like you.
There is no "VSCodedUITestFramework" listening on port 6621. Any idea ?
May 11, 2015 at 2:19 PM
cgaulay wrote:
When i run IpOverUsbEnum command, i don't have the same output like you.
There is no "VSCodedUITestFramework" listening on port 6621. Any idea ?
Can you share your output?

If you have "VSUnitTestFramework", that works as well. Some others might work also, but those two I tested myself.
May 11, 2015 at 2:32 PM
Edited May 11, 2015 at 2:33 PM
I don't have "VSUnitTestFramework" at all.
This is my output : Imagemy output
May 11, 2015 at 2:42 PM
This mapping seems to work as well:
Msvsmon 8016 -> 127.0.0.1:8016
So change the source (MainPage.xaml.cs) to have port 8016 and once you run the app, check from the settings that it shows that as the port.

Then, you can try a Web browser on the PC onto which the device is connected to via USB and try to load this address http://127.0.0.1:8016/status. If that returns a JSON response, the connection over USB is working.
May 12, 2015 at 6:05 AM
Hi VJ,

This looks something interesting. Can you please little elaborate that what you are trying to do and how far you close it?

May 12, 2015 at 6:15 AM
asthanarht wrote:
Hi VJ, This looks something interesting. Can you please little elaborate that what you are trying to do and how far you close it?
I wanted to help cgaulay get connected to the driver via USB connection. Based on my testing, it is possible with the instructions given in earlier comments. The only change needed in the driver side is to use one of the ports that has an existing mapping associated by the existing IP over USB service.

If I'd do something related to this in the driver, it would be allowing user to change the port from the driver app settings page so that the app doesn't have to be re-built when using the USB connection.
May 12, 2015 at 9:56 AM
vjrantal wrote:
This mapping seems to work as well:
Msvsmon 8016 -> 127.0.0.1:8016
So change the source (MainPage.xaml.cs) to have port 8016 and once you run the app, check from the settings that it shows that as the port.

Then, you can try a Web browser on the PC onto which the device is connected to via USB and try to load this address http://127.0.0.1:8016/status. If that returns a JSON response, the connection over USB is working.
That's working ! I've changes the port in the source code and build/deploy the driver onto the device.
When i load http://localhost:6621/status, that returns a JSON response.
It's very nice thank you !

But i've got a last question. You've say in comments that it's possible to execute some tests if they are "hosted on the PC to which the Windows Phone device is connected to". Why ? if it's possible to connect to http://localhost:port/status, why not on http://ipadressofpc:port/status ?
May 12, 2015 at 10:21 AM
cgaulay wrote:
But i've got a last question. You've say in comments that it's possible to execute some tests if they are "hosted on the PC to which the Windows Phone device is connected to". Why ? if it's possible to connect to http://localhost:port/status, why not on http://ipadressofpc:port/status ?
If you mean that why can't you do an HTTP request from your Windows Phone device to http://ipadressofpc:port/status __over USB__, the answer is that the IP over USB implementation doesn't give your host PC an IP address that could be reached out from the device.

Note that this will work just fine if the "ipadressofpc" is an IP address your PC has in a WLAN network, for example. Then, you can reach the PC from the Windows Phone device assuming the device is connected to the network.
May 12, 2015 at 10:25 AM
Ok, thanks. But it's not what i mean.

Why it's not possible to reach the IP address of the PC on 6621 port from another PC on the same network ?
May 12, 2015 at 10:30 AM
cgaulay wrote:
Ok, thanks. But it's not what i mean.

Why it's not possible to reach the IP address of the PC on 6621 port from another PC on the same network ?
Ah, okay, now I think I know what you mean.

For that, you need to do a port forwarding on the PC to which the phone is connected to. I haven't done this myself on Windows, but the first google hit was http://stackoverflow.com/questions/11525703/port-forwarding-in-windows and there might be other guidelines available as well. What you would want is a rule that says that connections to ipadressofpc:6621 should be forwarded to 127.0.0.1:6621.

Depending on your system, there might be also tweaks needed for firewalls etc. that prevents this kind of setup, but I think technically this should be all doable.
May 12, 2015 at 11:12 AM
vjrantal wrote:
cgaulay wrote:
Ok, thanks. But it's not what i mean.

Why it's not possible to reach the IP address of the PC on 6621 port from another PC on the same network ?
Ah, okay, now I think I know what you mean.

For that, you need to do a port forwarding on the PC to which the phone is connected to. I haven't done this myself on Windows, but the first google hit was http://stackoverflow.com/questions/11525703/port-forwarding-in-windows and there might be other guidelines available as well. What you would want is a rule that says that connections to ipadressofpc:6621 should be forwarded to 127.0.0.1:6621.

Depending on your system, there might be also tweaks needed for firewalls etc. that prevents this kind of setup, but I think technically this should be all doable.
Oh yes of course ! Thanks.
I do that and now it's working from another PC on the same network.
But when, in my test, i launch a RemoteWebDriver on the IP address of the driver, there is an error :
"Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.".
May 12, 2015 at 11:23 AM
I think this error is due to my environnement (proxy for exemple) .

Thanks a lot for your help !

i'll keep you informed as soon as possible.

Regards,
May 12, 2015 at 11:58 AM
One issue that you may run into in your setup is that there is nothing in place that guarantees that the Windows Phone and the driver app is running (and hasn't crashed, for example). This is different than with some solutions for other platforms (like iOS or Android) where there is a server running in the machine onto which the device is connected to and has some logic in place to restart app when it quits and so on.

The consequence is that you may need to every know and then manually check from the Windows Phone that the driver app is running or restart it if it gets stuck.
May 12, 2015 at 12:04 PM
Yes in fact.
Then, application is running in the background ? or i have to keep screen on for communicating with driver ?
May 12, 2015 at 12:47 PM
cgaulay wrote:
Then, application is running in the background ? or i have to keep screen on for communicating with driver ?
I think as the app is, it only continues running behind the lock screen if it is attached to a debugger.

In App.xaml.cs, there is following code:
// Prevent the screen from turning off while under the debugger by disabling
// the application's idle detection.
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
// and consume battery power when the user is not using the phone.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
If you move that outside of the "if (Debugger.IsAttached)", I believe the app should keep running.

A caveat is that nothing restarts the app if it crashes or for some other reason the device app manager needs to shut down the app (low memory or something like that).

Overall, I would say this project currently has lots of limitations in regards to supporting an always-on-driver.