Couldn't start UWP app - {"error":"unknown error","message":"Element not found. (Exception from HRESULT: 0x80070490)"}}
Greeting,
Using the sample "SimpleCalculatorTests" as a template, I tried to start "HP Smart" app but WinAppDriver yield "Element not found" exception without much details, attaching log below.
No problem with Calculator, or the "Amazon" app with application id: Amazon.com.Amazon_343d40qqvtj1t!App Error with the "HP Smart" app with application id: AD2F1837.HPPrinterControl_v10z8vjag6ke6!App
Code: (modified from SimpleCalculatorTests sample)
import unittest
from appium import webdriver
from time import sleep
class SimpleCalculatorTests(unittest.TestCase):
@classmethod
def setUpClass(self):
#set up appium
desired_caps = {}
#desired_caps["app"] = "Amazon.com.Amazon_343d40qqvtj1t!App"
desired_caps["app"] = "AD2F1837.HPPrinterControl_v10z8vjag6ke6!App"
self.driver = webdriver.Remote(
command_executor='http://15.37.176.170:4723',
desired_capabilities= desired_caps)
@classmethod
def tearDownClass(self):
self.driver.quit()
def test_initialize(self):
sleep(20)
self.assertEqual(1, 1)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(SimpleCalculatorTests)
unittest.TextTestRunner(verbosity=2).run(suite)
Log from Ubuntu which executed the test:
hpauto@ubuntu:~/Desktop/test$ python3 test_smart.py
ERROR
======================================================================
ERROR: setUpClass (__main__.SimpleCalculatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_smart.py", line 16, in setUpClass
desired_capabilities= desired_caps)
File "/home/hpauto/site_lib/Appium_Python_Client-0.22-py2.7.egg/appium/webdriver/webdriver.py", line 36, in __init__
super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
File "/home/hpauto/site_lib/selenium-3.11.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/hpauto/site_lib/selenium-3.11.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/hpauto/site_lib/selenium-3.11.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/home/hpauto/site_lib/selenium-3.11.0-py2.7.egg/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Element not found. (Exception from HRESULT: 0x80070490)
----------------------------------------------------------------------
Ran 0 tests in 2.372s
FAILED (errors=1)
Log from WinAppDriver:
C:\WINDOWS\system32>"c:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe" 15.37.176.170 4723
Windows Application Driver listening for requests at: http://15.37.176.170:4723/
Press ENTER to exit.
==========================================
POST /session HTTP/1.1
Accept: application/json
Accept-Encoding: identity
Connection: Keep-Alive
Content-Length: 128
Content-Type: application/json;charset=UTF-8
Host: 15.37.176.170:4723
User-Agent: Python http auth
X-BlueCoat-Via: 2a84e0f32f31b460
{"desiredCapabilities": {"app": "Amazon.com.Amazon_343d40qqvtj1t!App"}, "capabilities": {"firstMatch": [{}], "alwaysMatch": {}}}
HTTP/1.1 200 OK
Content-Length: 117
Content-Type: application/json
{"sessionId":"FE7E9628-F364-476D-9643-2F8135C5670A","status":0,"value":{"app":"Amazon.com.Amazon_343d40qqvtj1t!App"}}
==========================================
DELETE /session/FE7E9628-F364-476D-9643-2F8135C5670A HTTP/1.1
Accept: application/json
Accept-Encoding: identity
Connection: Keep-Alive
Content-Type: application/json;charset=UTF-8
Host: 15.37.176.170:4723
User-Agent: Python http auth
X-BlueCoat-Via: 2a84e0f32f31b460
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json
{"sessionId":"FE7E9628-F364-476D-9643-2F8135C5670A","status":0}
==========================================
POST /session HTTP/1.1
Accept: application/json
Accept-Encoding: identity
Connection: Keep-Alive
Content-Length: 136
Content-Type: application/json;charset=UTF-8
Host: 15.37.176.170:4723
User-Agent: Python http auth
X-BlueCoat-Via: 2a84e0f32f31b460
{"capabilities": {"firstMatch": [{}], "alwaysMatch": {}}, "desiredCapabilities": {"app": "AD2F1837.HPPrinterControl_v10z8vjag6ke6!App"}}
HTTP/1.1 500 Internal Error
Content-Length: 115
Content-Type: application/json
{"status":13,"value":{"error":"unknown error","message":"Element not found. (Exception from HRESULT: 0x80070490)"}}
Hi Zaavio,
Any update on this issue. Am unable to launch the app with same error. Please help in this regards.
Thanks, Surya
No update but made a workaround: start app as "Root", then use the start menu to search and open the app needed to be tested.
Also halted my team's further development on using WinAppDriver after running into couple more fundamental driver problems while the project update/commit rate is close to none; feels like WinAppDriver is close to death when Microsoft shifted their focus into Progressive Web Apps (PWAs) instead.
It looks like the app name is incorrect. Amazon.com.Amazon_343d40qqvtj1t!App matched correctly, but AD2F1837.HPPrinterControl_v10z8vjag6ke6!App did not.
Have you tried using a different name, or specifying the literal path to the program (if possible) to check?
This is what I got from calling "Get-AppxPackage" on powershell. I don't believe I can start this UWP app directly with its path "C:\Program Files\WindowsApps\AD2F1837.HPPrinterControl_85.1.379.0_x64__v10z8vjag6ke6"; permission issue. I could try further on using the path but that's not the documented way of starting an UWP app...
Name : AD2F1837.HPPrinterControl
Publisher : CN=ED346674-0FA1-4272-85CE-3187C9C86E26
Architecture : X64
ResourceId :
Version : 85.1.379.0
PackageFullName : AD2F1837.HPPrinterControl_85.1.379.0_x64__v10z8vjag6ke6
InstallLocation : C:\Program Files\WindowsApps\AD2F1837.HPPrinterControl_85.1.379.0_x64__v10z8vjag6ke6
IsFramework : False
PackageFamilyName : AD2F1837.HPPrinterControl_v10z8vjag6ke6
PublisherId : v10z8vjag6ke6
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
Dependencies : {Microsoft.NET.Native.Framework.1.7_1.7.25531.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Runtime.1.7_1.7.25531.0_x64__8wekyb3d8bbwe,
Microsoft.VCLibs.140.00_14.0.25426.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
When I asked the development team to use the following instruction to grab the application id, they gave me the same "AD2F1837.HPPrinterControl_85.1.379.0_x64__v10z8vjag6ke6"
You can find the Application Id of your application in the generated AppX\vs.appxrecipe file under RegisteredUserModeAppID node. E.g. c24c8163-548e-4b84-a466-530178fc0580_scyf5npe3hv32!App
It's also the same value I got from Task Manager > Process > Property
P.S. I get the same error starting some other apps with the same method:
OK (no problem): "Microsoft.SkypeApp_kzf8qxf38zg5c!App" "Microsoft.WindowsStore_8wekyb3d8bbwe!App" "Microsoft.MicrosoftSolitaireCollection_8wekyb3d8bbwe!App"
Fail (same 'Element not found' error): "Microsoft.MSPaint_8wekyb3d8bbwe!App" "Microsoft.XboxApp_8wekyb3d8bbwe!App" "microsoft.windowscommunicationsapps_8wekyb3d8bbwe!App" "Microsoft.BingNews_8wekyb3d8bbwe!App"
Thanks Zavvio. Working with the work around.
Closing issue due to being resolved with @zavvio 's workaround.
I don't know why this issue is closed. Still, I am facing the same issue.
org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'NOLAPF2FFLWS598', ip: '172.22.56.49', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: WindowsDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.execute(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
at org.openqa.selenium.remote.RemoteWebDriver.
While @zavvio has presented a work around, doesn't this still represent a real issue with the main functionality of winappdriver? Seems like this should be left open. We are experiencing this same issue.
WinAppDriver V1.1 Selenium V3.12.1 Appium.Webdriver nuget V3.0.0.2
C# unit test:
DesiredCapabilities appCapabilities = new DesiredCapabilities();
appCapabilities.SetCapability("app", "Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe!App");
var session = new WindowsDriver
WinAppDriver:
POST /session HTTP/1.1 Accept: application/json, image/png Connection: Keep-Alive Content-Length: 164 Content-Type: application/json;charset=utf-8 Host: 127.0.0.1:4723 User-Agent: selenium/3.12.0 (.net windows)
{"desiredCapabilities":{"app":"Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe!App","platformName":"Windows"},"capabilities":{"firstMatch":[{"platformName":"Windows"}]}} HTTP/1.1 500 Internal Error Content-Length: 115 Content-Type: application/json
{"status":13,"value":{"error":"unknown error","message":"Element not found. (Exception from HRESULT: 0x80070490)"}}
==========================================
Sorry we'll dig into this.
Is there an update on this issue? We are using AppiumLibrary in RobotFramework to launch and app and we are getting the same error.
We are PoCing WinAppDriver.exe and Appiumlibrary in RobotFramework/Python as one of the viable solutions for Windows App automation.
Can we get root cause/ETA on a fix for this issue?
Hey there, I searched a while and never really got a clear (or at least clear to me :) ) answer about this problem.
Quick context:
I'm also "PoCing" APPIUM for Android/IOS/UWP apps and when it came to Windows I struggled to launch the UWP app by using the "app" capability.
It turns out that you can't launch it with !App, App here is NOT a common word/suffix, it's defined by the
<Applications>
<Application Id="<hereIsTheValueYouWant>" ...
Hope this will help someone else. @YouWhy
PS : you can also get this information by getting installed package properties:
Get-AppxPackage *yourAppPartialName* | Format-Wide Name
Is there an update on the issue? I am facing this same problem when trying to execute the WinAppDriver tests on Bamboo. Locally the tests work OK.
Hello @CataUdrea ,
I'm not quite sure there's an issue here, or at least the one encountered by @zavvio or @hoorncj does not appear to be one since they say they used the calculator app code to base their script upon.
The example given by hoorncj is easy to demonstrate (I dont have the HP app under hand ). The app is called with this string: "Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe!App" but should be in fact called with this one : "Microsoft.MicrosoftOfficeHub_8wekyb3d8bbwe!Microsoft.MicrosoftOfficeHub" as explained in my previous post.
Above solution works for me. thanks.
Your code is Wrong in Place of Webdriver Put Windows driver