Open sravv opened 7 years ago
Please try selenium==2.45.0. It should work. If it does, but you want to use newer selenium bindings, try https://github.com/2gis/Winium.StoreApps.CodedUi/tree/fix-empty-request-crash branch, it has a fix for such problem.
Let me know if branched version helps with new bindings, I will merge it asap then.
Hi Nick,
Thanks i will try that solution and let you know the results. But i had just added the registry key that was mentioned as part of this https://github.com/2gis/Winium.StoreApps.CodedUi/issues/1#issuecomment-94719621 and did not follow anything which is mentioned here https://dev.windowsphone.com/en-US/OEM/docs/Phone_Testing/Configuring_IP_over_USB because i was not able to open this link. Is that fine?
Yes, it should be fine. Link was added to reference the source for further reading.
Hi Nick,
I have some doubt, in the python sample code : command_executor='http://localhost:9998 we are using this command_executor right.. should we make sure that this is accessible from the browser of test machine (by installing IIS server and adding the binding for http and port 9998) ??
I am not sure what you mean by executor being accessible from browser. When you start driver it will bind to all interfaces, meaning that it can be accessed not only from localhost, but from other hosts in network. If you run tests from host A, and driver is running on host B, then in your tests you will need to specify ip address or network name of host B instead of localhost.
Hi Nick,
I installed selenium 2.45.0 and executed the same code, but this time it is throwing error as "[WinError 10054] An existing connection was forcibly closed by the remote host"
Please see the screenshot:
The error logs of Test_sample.py script are attached. PythonLogs.txt
Please can you tell me what has went wrong??
Hi Nick,
I am able to connect with windows 10 phone, I am trying to install UWP application with .appxbundle, but i am getting error as "Unknown error: A packaging error prevented this application from installing." Can you please tell me if we have to do any changes to install UWP app through .appxbundle ??
Thanks.
This might be related to https://github.com/2gis/Winium.Mobile/issues/116
Please try workaround by removing dependencies as described in https://github.com/2gis/Winium.Mobile/issues/116#issuecomment-162839134
Hi Nick,
Again i am facing same issue with error : "[WinError 10054] An existing connection was forcibly closed by the remote host" :( :(
How can we make sure the connection will be consistent. Are there any pre-req to be taken care always before we start the script??
Hi Nick,
Any solution for above problem?? Your help would be very much needed.. i tried with different windows 10 phone also but i am getting the same error again and again .. not able to proceed further..
Why your driver output says that it listens on port 9998?
Have you modified listening port value? The driver itself should listen on port 9999
.
Port 9998
will be used by Winium.StoreApps.CodedUITestProject
which is hosted on device.
Hi Nick,
The reason why is used port 9998 was, the registry settings was as follows: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IpOverUsb\Winium] "DestinationAddress"="127.0.0.1" "DestinationPort"=dword:0000270e "LocalAddress"="127.0.0.1" "LocalPort"=dword:0000270e
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IpOverUsbSdk\Winium] "DestinationAddress"="127.0.0.1" "DestinationPort"=dword:0000270e "LocalAddress"="127.0.0.1" "LocalPort"=dword:0000270e
So here dword:0000270e means 9998 port, that is why i build the driver solution with that port.
Soo.. according to you both registry and driver should be at port 9999 or just the driver at 9999 and registry at 9998 itself?? Can you please clarify? :)
9999
should be used for driver.9998
should be used as a value of registry key.This is due to the fact that we actually have two servers. There is driver itself that is run on a host system. Your tests should connect to the port used by driver (9999
). When you start new session driver deploys automation server onto device, app under test running on a device is not accessible from outside of this device. This server will listen on 9998
on device, so this port should be forwarded to your host system, so that driver could access it. That is what we do by adding keys to registry with 9998
value.
Hi Nick,
I was able to connect successfully after following the above ports... Thanks.. :) But when i am trying to deploy UWP app on win 10 mobile phone with .appxbundle i am getting the following error: "WebDriverException: Message: Unknown error: A packaging error prevented this application from installing." Can you please tell me in detail how to overcome this error? What changes should be made while creating the package of UWP app?? or I can install the UWP manually and after that i should be able to interact with the app is that possible?? How can i skip the installation of UWP app and directly proceed to test my UWP app on mobile??
Thanks.
You can skip app
capability at all or set it to null
in your desired capabilities.
Also please see https://github.com/2gis/Winium.Mobile/issues/116#issuecomment-162839134 for workaround on UWP deployment.
Another workaround that worked for me was to first deploy application using Visual Studio, so that dependencies like frameworks get deployed correctly, and then deploy appx only using the driver.
Hi Nick,
I tried the first workaround by removing the capability of app, but that did not work at all, i have attached the logs: DriverLogs.txt PythonLogs.txt
The second approach of building the app with the framework dependencies cannot be done because we have to use the same UWP app without any changes :(
Can you please provide me the modified code/winium solution which will not install the uwp app instead make use of the existing already installed UWP app on the mobile phone, so that we can interact with the installed UWP app through winium ??
Your help will be very much useful.
Thanks.
Attached logs suggest that there is still a problem with connecting to CodedUi server that is running on the device.
Please make sure that you modified registry as required, Windows Phone device is connected via USB and can be deployed to using Visual studio or AppDeploy. Also, you should have developer mode enabled.
Hi Nick,
I am getting those connectivity errors ONLY when i remove the "app" from desired capabilities. When i add the app in desired capability i will get error saying "Error in installing the package"
Now i am trying to use your second work-around to deploy the UWP app in Visual Studio
I am building/deploy the UWP app in visual studio 2015, what references related to winium should be added and where should we add so that the UWP app will install successfully through winium driver?
Can you please provide me detailed steps during deploying UWP app where I should reference the winium related dlls?
The main aim is i should be able to deploy the UWP appx on my windows 10 mobile phone using winium.storeapps.driver :)
Thanks.
Hi Nick,
I am actually trying to deploy UWP app which was developed on Visual studio 2015. Trying to install UWP app which is "arm" (UWPApp_ARM.appx) package on windows 10 mobile phone. The steps followed to run this was: -> Built the Winium.Storeapps.driver.exe on visual studio 2013 -> In the Test Sample edited the desired capabilitires section as follows: desired_capabilities = { 'deviceName': 'Device',
'deviceIpAddress': 'localhost',
'locale': 'en-US',
'debugCodedUI': False,
'app': r"..\..\Winium.StoreApps.TestApp\AppPackages\UWPApp_ARM_ARM"
r"\UWPApp_ARM_ARM.appx"
}
-> Under "Winium.StoreApps.TestApp\AppPackages\UWPApp_ARM_ARM" path i have just placed my UWPApp_ARM_ARM.appx installer (tried by placing only this installer and this installer along with dependencies, where dependencies folder just had ARM dependencies). -> Executed the driver and then the tests got the below error.
I am getting error as "selenium.common.exceptions.WebDriverException: Message: Unknown error: A packaging error prevented this application from installing."
Can you please tell me what i am missing here? or **
Is it possible to skip the installation of UWP app and directly start interacting with the installed UWP application on the windows 10 phone??
**
I just want to interact with the UWP app which is already installed on the windows phone so that i can skip the packaging error... :(
Hi,
You should be able to skip app installation by removing app
capability from your desired capabilities.
I do not know how to best handle packaging error, this is due to the fact that we use AppDeploy code that was written for Windows Phone 8.1. It works for basic apps like sample app, but might fail for complex apps because of dependencies.
Take a look at https://github.com/2gis/Winium.Mobile/issues/116 . You can try deploying your appx manually to the device before trying to test it.
From: sravv [mailto:notifications@github.com] Sent: Monday, March 20, 2017 6:40 PM To: 2gis/Winium.StoreApps.CodedUi Winium.StoreApps.CodedUi@noreply.github.com Cc: Абалов Николай Владимирович n.abalov@2Gis.ru; Comment comment@noreply.github.com Subject: Re: [2gis/Winium.StoreApps.CodedUi] Cannot connect to Windows 10 phone (#35)
Hi Nick,
I am actually trying to deploy UWP app which was developed on Visual studio 2015. Trying to install UWP app which is "arm" (UWPApp_ARM.appx) package on windows 10 mobile phone. The steps followed to run this was: -> Built the Winium.Storeapps.driver.exe on visual studio 2013 -> In the Test Sample edited the desired capabilitires section as follows: desired_capabilities = { 'deviceName': 'Device',
'deviceIpAddress': 'localhost', 'locale': 'en-US', 'debugCodedUI': False, 'app': r"....\Winium.StoreApps.TestApp\AppPackages\UWPApp_ARM_ARM" r"\UWPApp_ARM_ARM.appx"
}
-> Under "Winium.StoreApps.TestApp\AppPackages\UWPApp_ARM_ARM" path i have just placed my UWPApp_ARM_ARM.appx installer (tried by placing only this installer and this installer along with dependencies, where dependencies folder just had ARM dependencies). -> Executed the driver and then the tests got the below error.
I am getting error as "selenium.common.exceptions.WebDriverException: Message: Unknown error: A packaging error prevented this application from installing."
Can you please tell me what i am missing here? or **
Is it possible to skip the installation of UWP app and directly start interacting with the installed UWP application on the windows 10 phone??
**
I just want to interact with the UWP app which is already installed on the windows phone so that i can skip the packaging error... :(
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/2gis/Winium.StoreApps.CodedUi/issues/35#issuecomment-287736359, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA05s91xATP9o-zkUzFdIajUP8sPtESrks5rnmWngaJpZM4MSkDa.
Hi Nick,
Is it possible to give me the edited solution which skips the Installation of the UWP app and just proceeds to test the UI elements of the app?
Because when i removed the app capabilities , i was just getting error for connection. If i give the app capablities i was getting error for installing the package. It will be very usefull to proceed.
Thanks.
Driver does skip app installation if app
capability is empty. You can take a look at standard calendar example TestStandardCalendar
If you get connection error when app
capability is empty, then you most likely did not forward ports correctly, or did not allow developer mode on device or host system.
Hi Nick,
The driver is running with port 9999 and the registry key is been set to 9998. Both mobile and the host system are enabled with developer mode. When i remove "app" from desired capability i am getting connection error and when the app capability is given i am getting package error .. :( Can you please try once?
And also how will the driver come to know that which app to launch and test ? (If we skip the installation of the app)
In test sample linked in my previous comment we use tile id to open calendar app:
self.driver.switch_to.window('_:_:Microsoft.MSCalendar_8wekyb3d8bbwe!x36f9fa1cyfdady4cf0y99ecyc03771ed741ax')
Could you please confirm if this sample works for you on following:
Good to know that :)
But how to resolve that connection error? :( Can you please try once if you are also getting the same issue ? Because all the settings i have done as you told and as mentioned in the links. It would be great if there is any workaround that i have to follow to get rid of this connection error.
Thanks.
Hi Nick,
One more doubt how do i get the tile id of the UWP app developed by me?
My mobile was not having the calendar app so may b it was failing to execute.
Thanks.
Hi Nick,
I actually wanted it to work only on Mobile but not on emulators or with win 8.1 so i did not try with those.
The mobile which i am using is not having calendar app maybe because of that its not able to launch and might be throwing "ERROR: Cannot connect to server ". So i am trying to see if i will be able to launch calculator app directly. My mobile is having calculator app , can you please give me the tile automation ID of calculator app so that i will try replace that in the python script and try to execute it again through self.driver.switch_to.window instead of calendar???
By this i can confirm that if there is actually a connection failure. Thanks in advance.. :)
If it gives ERROR: Cannot connect to server
, then it definitely problem with connecting to CodedUI server. For CodedUI you need premium VS license, what version of VS do you have?
One way to get tile id is to use driver itself. You need to open home screen on your connected device or emulator. Then run a test case that contains a call to PageSource
command.
ps = self.driver.page_source
print(ps)
The output would contain an xml with tiles from your home screen with associated ids.
But this requires you to be able to connect to the server.
I would suggest you to try it out with Windows Phone 8.1 emulator and then Windows 10 Mobile emulator if 8.1 worked. This will help debug the problem by narrowing scope.
I just tested it on both Windows Phone 8.1 and Windows 10 Mobile emulators and it worked. I do not have access to Windows 10 Mobile device.
Hi Nick,
I am using Visual Studio 2013 Ultimate with update 3. Is this fine or should i use some other VS ??
VS 2013 Ultimate is what I've tested it on. So it should be ok.
Hi Nick,
I tried with windows 10 emulator( which i downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=53424 ).
I buiild the solution and ran the winium.storeapps.driver.exe and then i executed the python script, i am getting the same error"Cannot connect to server" .
I am attaching the logs and screenshot of the installed sample test app.
DriverErrorLogs.txt
PythonErrorLogs.txt
Test_Sample_PythonScript.txt
Can you please tell me what is that i am missing here because on the emulator also it is not working :( . Is the test app that got deployed on the app is correct and proper app? (because when i built the app i was getting different package name built)
Thanks.
For your information 10.106.132.51 is the ip address of my host machine.
Have you enabled developer mode on your Windows 10 Desktop machine from which you run your tests? https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development
Also, I just updated master to include some logging for unhandled exceptions. Could you please:
debugCaptureLogs
capability set to True
Once debugCaptureLogs
capability is set to true your logs should include line similar to [DEBUG] VSTEST: Results File: {path}\TestResults\{filename}.trx
. This log file will include any logs from CodedUI server.
Hi Nick,
I have enabled developer mode in my win10 desktop machine.
If I download the code from the same link which I downloaded previously, will i get the latest master code?
You can download latest source in master from this link https://github.com/2gis/Winium.StoreApps.CodedUi/archive/master.zip
But you will need to build it yourself
Hi Nick,
I have downloaded the latest source from https://github.com/2gis/Winium.StoreApps.CodedUi/archive/master.zip and built it.
I am attaching the driver logs and python logs, python script. Please let me know if you need anything else. DriverLogs.txt PythonErrorLogs.txt Test_Sample_PythonScript.txt
Do you have TestResults
folder (next to driver executable) with *.trx
files in it?
Your logs are missing [DEBUG] VSTEST: Results File: {path}\TestResults\{filename}.trx
lines, so either you run old version of driver, or you have a problem with VSTEST or CodedUI.
Hi Nick,
I have taken the latest code given by you https://github.com/2gis/Winium.StoreApps.CodedUi/archive/master.zip and built it. And in the python script I added the CaptureLogs part and executed the driver/script. I am not getting any TestResults folder.. :(
Anything i am missing here? The code link which you gave was updated?
Thanks.
Nick, My physical machine is dual OS (both win10_x64), if this is causing any problem?
Do not think so, but I do not know why it does not work for you, sorry.
You can try setting debugCodedUi
capability to true
, then start CodedUiTestMethod1
from Winium.StoreApps.CodedUITestProject
manually in debug mode. After that you can start driver and try to run your tests. This way you would be able to see if our CodedUI test server was able to start successfully and if there are any exceptions in it.
I am running tests on Windows 10 mobile device using coded ui. Was able to build the solution to get Winium.Storeapps.driver.exe , executed this Winium.StoreApps.DRiver.exe and ran the test_sample.py script. My mobile was not able to connect to the server. I've added below keys Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IpOverUsb\Winium] "DestinationAddress"="127.0.0.1" "DestinationPort"=dword:0000270e "LocalAddress"="127.0.0.1" "LocalPort"=dword:0000270e
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IpOverUsbSdk\Winium] "DestinationAddress"="127.0.0.1" "DestinationPort"=dword:0000270e "LocalAddress"="127.0.0.1" "LocalPort"=dword:0000270e
I've also set deviceipaddress to 'localhost'
When i executed the driver and then the python script i got the following error:![errorafterrunningthetest_samplescript](https://cloud.githubusercontent.com/assets/26170696/23562319/fc400504-0067-11e7-8737-8cddab3d0d02.png)
I have also attached the error logs obtained when test_sample.py script was executed. Attached the used Test_Sample.py script as well. Selenium version used is `3.0.2
Please let me know what mistake i am doing ASAP.
test_sample_py.zip