I am trying to Automate our Windows Forms App which is developed based on Visual basic. I am facing issue in recognizing elements by WinAppDriver.Issue seems like WinAppDriver isn't recognizing the App. I am able to open the App but its not able to recognize the next screen (which takes time to load Application).
protected static WindowsDriver Session = null;
private static WebElement Result = null;
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("app","C:\XXX\XXX\ABC.exe");
Session = new WindowsDriver(new URL("http://127.0.0.1:4723"),capabilities);
Session.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
Result = Session.findElementByName("OK");
Assert.assertNotNull(Result);
}
I tried to see if its recognizing any element by
Session.findElements(By.id("*"));
But I am getting null list.
I am using Selenium 3.14 , Java 1.8, WinAppDriver 1.1, TestNG 6.14
WinAppDriver Log:
POST /session HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 318
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)
{
"desiredCapabilities": {
"app": "C:\xxx\xx\ABC.exe",
"platformName": "Windows"
},
"capabilities": {
"firstMatch": [
{
"appium:app": "C:\xxx\xx\ABC.exe",
"platformName": "windows"
}
]
}
}
HTTP/1.1 200 OK
Content-Length: 163
Content-Type: application/json
{"sessionId":"300D3A55-8F4E-4B14-8049-0396003FE6B4","status":0,"value":{"app":"C:\xxx\xx\ABC.exe","platformName":"Windows"}}
GET /session/300D3A55-8F4E-4B14-8049-0396003FE6B4 HTTP/1.1
Accept-Encoding: gzip
Cache-Control: no-cache
Connection: Keep-Alive
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)
HTTP/1.1 200 OK
Content-Length: 112
Content-Type: application/json
{"status":0,"value":{"app":"C:\xxx\xx\ABC.exe","platformName":"Windows"}}
GET /session/300D3A55-8F4E-4B14-8049-0396003FE6B4 HTTP/1.1
Accept-Encoding: gzip
Cache-Control: no-cache
Connection: Keep-Alive
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)
HTTP/1.1 200 OK
Content-Length: 112
Content-Type: application/json
{"status":0,"value":{"app":"C:\xxx\xx\ABC.exe","platformName":"Windows"}}
POST /session/300D3A55-8F4E-4B14-8049-0396003FE6B4/timeouts HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 39
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)
{
"type": "implicit",
"ms": 60000
}
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json
{"sessionId":"300D3A55-8F4E-4B14-8049-0396003FE6B4","status":0}
POST /session/300D3A55-8F4E-4B14-8049-0396003FE6B4/element HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 38
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)
{
"using": "name",
"value": "OK"
}
HTTP/1.1 404 Not Found
Content-Length: 139
Content-Type: application/json
{"status":7,"value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters."}}
Console Error:
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'XXX', ip: '10.97.4.254', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
Driver info: io.appium.java_client.windows.WindowsDriver
Capabilities {app: C:\xxx\xx\ABC.exe..., javascriptEnabled: true, platform: WINDOWS, platformName: WINDOWS}
Session ID: 6D65341F-3DB1-4115-9A4E-F5634C477B1D
*** Element info: {Using=name, value=OK}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
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.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.findElement(WindowsDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:404)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByName(DefaultGenericMobileDriver.java:118)
at io.appium.java_client.AppiumDriver.findElementByName(AppiumDriver.java:1)
at io.appium.java_client.windows.WindowsDriver.findElementByName(WindowsDriver.java:1)
at Connexus.setup(Connexus.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:455)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:168)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
App is opening, So its not problem with location. But it's not recognized by WinAppDriver. Please let me know If I am doing anything wrong here.