2gis / Winium.Mobile

Winium.Mobile is Selenium Remote WebDriver implementation for automated testing of Windows StoreApps and Silverlight apps, tested on emulators (currently only Windows Phone/Mobile apps are supported).
Mozilla Public License 2.0
51 stars 29 forks source link

Getting "There is an error in XML document (2,2)". #82

Closed rahulLiving closed 9 years ago

rahulLiving commented 9 years ago

After making winium setup ready. which looks like

screen shot 2015-09-03 at 2 12 38 pm

The driver is running on port 9999 and test automation server under test in installed i.e by placing "AutomationServer.Instance.InitializeAndStart();" this in AUT Code and also added reference to Inner Server in AUT project

And on running the TestCase getting an error which looks like

screen shot 2015-09-03 at 2 22 45 pm

As i am trying to run my First Test Case using Winium . Am i missing soemthing ? Please help me out.

NickAb commented 9 years ago

The error looks very strange, as XML is not used directly in driver, except for GetPageSource command and application deployment step.

To debug this case could you please try deploying the same .appx file using Windows Phone Application Deployment 8.1 from C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Windows Phone SDK 8.1.

Driver logs will help a lot. You can either run driver with --verbose command and copy console output or run driver with --log-path option to save logs to file. Try Winium.StoreApps.Driver.exe --help for more help on command line options.

rahulLiving commented 9 years ago

I am using Windows 10 phone emulator (it supports windows 10 right?) , i am able to deploy it on emulator manually.

And while running with Winium.StoreApps.Driver.exe --help command, i got the below log.

11:09:57 [INFO] Winium.StoreApps.Driver, Version: 1.3.0.16463, Revision: 9a5568675ebb1ec9567cf0c4aea90bb2ca5ed5b2 Starting Winium.StoreApps.Driver on port 9999

11:09:58 [DEBUG] Waiting for a connection... 11:09:39 [DEBUG] ACCEPTED REQUEST POST /session HTTP/1.1 11:09:39 [INFO] COMMAND newSession { "desiredCapabilities": { "app": "C:\Automation\KitchenSink.appx" } } 11:09:40 [INFO] Target emulator: Mobile Emulator 10.0.10240.0 WVGA 4 inch 512MB 11:09:40 [DEBUG] RESPONSE: OK: {"sessionId":"AwesomeSession","status":13,"value":{"error":"unknown error","stacktrace":" at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)\r\n at System.Xml.Serialization.XmlSerializer.Deserialize(TextReader textReader)\r\n at Microsoft.Phone.Tools.Appx.Package.LoadFromStream(Stream stream, Boolean fromBundle)\r\n at Microsoft.Phone.Tools.Deploy.Utils.ReadAppManifestInfoFromAppxStream(Stream packageStream, Boolean fromBundle)\r\n at Microsoft.Phone.Tools.Deploy.Utils.ReadAppManifestInfoFromAppx(String packagePath)\r\n at Microsoft.Phone.Tools.Deploy.Utils.ReadAppManifestInfoFromPackage(String path)\r\n at Winium.StoreApps.Driver.EmulatorHelpers.Deployer81.get_AppManifestInfo() in d:\Projects\windows-universal-app-driver\Winium\Winium.StoreApps.Driver\EmulatorHelpers\Deployer81.cs:line 93\r\n at Winium.StoreApps.Driver.EmulatorHelpers.Deployer81.Install() in d:\Projects\windows-universal-app-driver\Winium\Winium.StoreApps.Driver\EmulatorHelpers\Deployer81.cs:line 121\r\n at Winium.StoreApps.Driver.Automator.Automator.InitializeApp() in d:\Projects\windows-universal-app-driver\Winium\Winium.StoreApps.Driver\Automator\Automator.cs:line 156\r\n at Winium.StoreApps.Driver.CommandExecutors.NewSessionExecutor.DoImpl() in d:\Projects\windows-universal-app-driver\Winium\Winium.StoreApps.Driver\CommandExecutors\NewSessionExecutor.cs:line 20\r\n at Winium.StoreApps.Driver.CommandExecutors.CommandExecutorBase.Do() in d:\Projects\windows-universal-app-driver\Winium\Winium.StoreApps.Driver\CommandExecutors\CommandExecutorBase.cs:line 42","message":"There is an error in XML document (2, 2)."}} 11:09:40 [DEBUG] Client closed

11:09:40 [DEBUG] Waiting for a connection...

NickAb commented 9 years ago

It was not tested with Windows 10 Phones yet, but we expected it to work with Windows 10 without any major modifications. The problem seems to be caused by the fact that Driver uses old Microsoft.Phone.Tools.Deploy library shipped with WP 8.1 SDK.

If you successful deployed application manually using Application Deployment tool, then you can try to look if there is a newer version of Microsoft.Phone.Tools.Deploy is shipped with app deployment tool and replace old versions (shipped with driver) by new version from you system files, but this is a wild guess.

I will be able to take a closer look at supporting Windows 10 somewhere after September 14th.

NickAb commented 9 years ago

The problem is due AppManifest.xml format changes, including some changes in namespace and tag names.

To deserialize app manifest Package class from C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\Microsoft.Phone.Tools.Deploy.dll is used. Due to coupling in this assembly I had to basically copy and modify whole Utils and related classes from this assembly.

This fixed reading xml file, but when underlying SmartDevice Connectivity methods are called to install dependencies or app itself, then it fails with exception "Package failed updates, dependency or conflict validation". Installing package using VS 2015 first (to install dependencies), removing it and running deployment programmatically did install the app, but it failed to launch correctly.

NickAb commented 9 years ago

There is WinAppDeploy shipped with Windows 10 SDK. This tool seems to be an official way to side load apps to devices. There is one major downside, it requires pairing device with host first, i.e. before using driver with emulator one will have to pair emulator to host and create default checkpoint after that.