1
Vote

Unable to successfully depoly the WebDriver

description

Hi,

I'm unable to successfully depoly the WebDriver on my Windows Phone emulator (on real device it doesn't work as well).
I've got:
  • Windows 8.1 operaring system
  • Microsoft Windows Phone 8 SDK installed
  • Visual Studio 2013 update 4 installed
  • .NET Framework 4.5 installed
I downloaded the package and unpacked it on my local disk. Afterwards I ran the 'StartWindowsPhoneDriver.cmd' file. I could observe the following:
  • Command prompt opens and command from .cmd file can be seen
  • WIndows Phone Emulator starts
  • Kind of WP WebView app starts and title 'Windows Phone Selenium WebDriver' can be seen
  • IP address blinks in the command prompt and suddenly command prompt closes (Emulator remains running with a kind of o WebView app running as well)
To capture the IP address that was displayed I launched the elevated command prompt and copied into it the command from 'StartWindowsPhoneDriver.cmd' file. This enabled the command prompt not to disappear after IP is displayed.

When calling the driver from my IDE with the following code:
DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
return driver = new RemoteWebDriver(new URL("http://<ip from cmd>:8080"), cap);
I get the following exception:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. >
I guess that the problem is not in the way I call the WebDriver but in the Webdriver deployment. The fact that right after IP is displayed the connection breaks or sth like that seems to be the problem. My remark is that I can ping the captured IP even when the command prompt is closed and the emulator remains open.

Is this behaviour normal or shall the IP address stayed displayed until command prompt is terminated manually? What is wrong?

Regards,
M.

comments

asthanarht wrote Apr 28, 2015 at 6:15 AM

Try system Ip instead of given IP in emulator.

MikeM2PL wrote Apr 28, 2015 at 8:58 AM

It doesn't work. If I try to create the RemoteWebDriver object with the aid of the IP adresss from the command prompt I get the following exception:
rg.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'EDIT(cut out)', ip: 'EDIT(cut out)', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_31'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
    ...
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Caused by: org.openqa.selenium.WebDriverException: Property name: status -> "0" on class int
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'EDIT(cut out)', ip: 'EDIT(cut out)', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_31'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.JsonToBeanConverter.propertyWriteException(JsonToBeanConverter.java:291)
    at org.openqa.selenium.remote.JsonToBeanConverter.convertBean(JsonToBeanConverter.java:268)
    at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:178)
    at org.openqa.selenium.remote.JsonToBeanConverter.convert(JsonToBeanConverter.java:41)
    at org.openqa.selenium.remote.http.JsonHttpResponseCodec.decode(JsonHttpResponseCodec.java:62)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
    ... 37 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.openqa.selenium.remote.JsonToBeanConverter.convertBean(JsonToBeanConverter.java:266)
    ... 42 more
If I use system ip then I get:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'EDIT(cut out)', ip: 'EDIT(cut out)', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_31'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
    ...
    at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to EDIT(cut out):8080 [/EDIT(cut out)] failed: Connection refused: connect
If I try with the real device I get:
C:\Tools\Selenium\WindowsPhoneDriver-4-14-028-10>DriverDeployTool.exe /isetool "%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool\IS
ETool.exe" /targetdevice device /xapfile "WindowsPhoneDriver.xap" /config "WindowsPhoneDriver.xml"  /setenv REMOTEWEBDRIVERIP
Target dosen't have any interface allowing connection.
In none of these cases the ip address can be seen in the emulator/device screen. It looks like below in case of both real device and emulator:
Image

Another important remark is that right after IP appears when executing StartWindowsPhoneDriver command in the elevated command prompt, new line is printed (shouldn't the ip adress be the last line printed as long as the connection with the emulator is maintained?) - which looks like:
C:\Tools\Selenium\WindowsPhoneDriver-4-14-028-10>DriverDeployTool.exe /isetool "%ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool\IS
ETool.exe" /targetdevice emulator /xapfile "WindowsPhoneDriver.xap" /config "WindowsPhoneDriver.xml"  /setenv REMOTEWEBDRIVERIP
http://169.254.48.13:8080/

C:\Tools\Selenium\WindowsPhoneDriver-4-14-028-10>
Any ideas why the driver is not working?

vjrantal wrote Apr 29, 2015 at 7:20 AM

You could try an experimental release from http://winphonewebdriver.codeplex.com/releases/view/611322 that doesn't use the DriverDeployTool at all. There might be some useful instructions under "Setting up"-title at http://blog.vjrantal.net/2015/02/05/angularjs-automated-testing-on-windows-phone/.

MikeM2PL wrote Apr 29, 2015 at 12:24 PM

I've tried with the experimental release and the results are the following:
I managed to successfully deploy app on Win 8.1 emulator (on Win 8.0 emulator this didn't work). I was also able to run my tests. As this is an exeprimental release let me just mention that common Selenium WebDriver methods such as WebElement.submit() or Driver.manage().timeouts().implicitlyWait() do not work.

As for the real device I managed to successfully depoly an app. However, when I entered the settings to check the IP address and port number, only the port number - '8080' was visible. Thus, I was unable to run the tests successfully as no IP address was assigned to my devce (Nokia Lumia with Win 8.1).

Do you have any idea why my Windows Phone 8.1 does not get the IP address?

vjrantal wrote Apr 29, 2015 at 1:39 PM

Was your device connected to a WLAN access point when you tried to use the driver? The IP address is not shown in settings if the device doesn't have an IP via the wireless interface.

The app doesn't work on Windows Phone 8.0 emulator, because it was turned into a Windows Phone 8.1 Silverlight app.

MikeM2PL wrote Apr 30, 2015 at 11:15 AM

That's the issue - well done. My device was not connected to WLAN which might have been obvious but not for me at that point.

I managed to successfully run the test on real device using the experimental release .xap file.

I've got one more question. Is it a normal behaviour that running tests on real device is that slow? - I mean that to complete the test which normally takes 10 seconds on my local computer's browser, my windows phone device needs something like 180 seconds. Is it a normal behaviour?

Just to remark - I also made a step back to check if the stable official version works with WLAN enabled. It didn't help - I still got the exception:
org.openqa.selenium.WebDriverException: Property name: status -> "0" on class int

vjrantal wrote Apr 30, 2015 at 12:37 PM

Good to hear you got it up and running!
I mean that to complete the test which normally takes 10 seconds on my local computer's browser, my windows phone device needs something like 180 seconds. Is it a normal behaviour?
It is expected that tests are slower than locally on a desktop browser, but 18x slower can't probably be explained with HTTP overhead and slower hardware. Have you tried on other mobile devices like iOS or Android phones?

MikeM2PL wrote May 4, 2015 at 11:53 AM

Good to hear you got it up and running!>
Indeed, thank you very much for help until this point.

Have you tried on other mobile devices like iOS or Android phones?>
Well, I've been using Selendroid to run tests on my Android device and those were quite fast - I haven't noticed any problems (though WLAN was not involved in that configuration).
That is why I suppose that the WLAN I've set up for the purposes of this WP web driver testing has sth to do with the tests running so slow. In the close future I'll try with different WLAN configuration and we'll see.
That's it for the moment or at least until you hit upon any other idea why the tests are running so slow.
One more time thanks for help, M.

MikeM2PL wrote May 4, 2015 at 11:57 AM

Good to hear you got it up and running!
Indeed, thank you very much for help until this point.
Have you tried on other mobile devices like iOS or Android phones?
Well, I've been using Selendroid to run tests on my Android device and those were quite fast - I haven't noticed any problems (though WLAN was not involved in that configuration).
That is why I suppose that the WLAN I've set up for the purposes of this WP web driver testing has sth to do with the tests running so slow. In the close future I'll try with different WLAN configuration and we'll see.

That's it for the moment or at least until you hit upon any other idea why the tests are running so slow.
One more time thanks for help, M.