Issue on getting initialize notapad.exe using WinAppDriver

395 views
Skip to first unread message

Mohamed Rafeek M

unread,
Sep 7, 2021, 10:54:21 AM9/7/21
to qaf users
Team,
I'm trying to automate windows application like notepad, calculator using WinAppDriver in QAF and java bdd approach. My property file contains below properties.

remote.server=127.0.0.1
remote.port=4723
driver.name=appiumDriver
appium.additional.capabilities={'platformName':'Windows','deviceName':'WindowsPC','automationName':'Appium','app':'C:\Windows\System32\notepad.exe','driverClass':'io.appium.java_client.windows.WindowsDriver'}
Issue: Notepad is not getting initialized by default. if I run below approach then its working as expected.
DesiredCapabilities capabilities1 = new DesiredCapabilities();
capabilities1.setCapability("app", "C:\\Windows\\System32\\notepad.exe");  
NotepadSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities1);
NotepadSession.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
Assert.assertEquals("Untitled - Notepad", NotepadSession.getTitle());        
NotepadSession.findElementByClassName("Edit").sendKeys("Some text");

Query:
I tried notepad.exe path with double quotes, double slash forward and backward etc nothing has worked.

Kindly refer attached both success and failure log in WinAppDriver log 
getting 404 not found. Kindly provide your support on this.

Regards,
Rafeek

notapadFailure_log.txt
notepadSuccess_log.txt

cjayswal

unread,
Sep 21, 2021, 3:34:08 PM9/21/21
to qaf users
It worked for me without any issue. See attached file.

I used following properties for setting capabilities

remote.port=4723
driver.name= appiumDriver
appium.capabilities.driverClass=io.appium.java_client.windows.WindowsDriver
appium.capabilities.app=C:\\Windows\\System32\\notepad.exe
It worked well as normal web driver test without issue:

@Test
    public void testCanEditInNotpad(){
        getDriver().verifyTitle(exact("Untitled - Notepad"));
        //getDriver().findElementByClassName("Edit").sendKeys("it worked!...")
        $("className=Edit").sendKeys("it worked!...");
    }

મંગળવાર, 7 સપ્ટેમ્બર, 2021ના રોજ 07:54:21 AM UTC-7 વાગ્યે rafej...@gmail.com દ્વારા આમ લખવામાં આવ્યું હતું:
WindowsDriverTest.java
Message has been deleted
Message has been deleted

Mohamed Rafeek M

unread,
Sep 23, 2021, 1:01:44 AM9/23/21
to qaf users
Hi Jaiswal,
Thank you for your response. Already, I've verified the same approach and again tried your suggestion with new project and end up with error.
Error: 
Unable to create driver instance in 1st attempt with retry timeout of 0 seconds. You can check/set value of 'driver.init.retry.timeout' appropriately to set retry timeout on driver initialization failure. Unable to Create Driver Instance for appium: org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: Unable to parse remote response: 

Steps Followed:
- I just download QAF Maven blank project
- Added application.Properties as you mentioned above.
- Added notepad win app steps
    @Test
    public void testCanEditInNotpad(){ }

Note: Kindly refer attached complete blank project file. Kindly verify and let me share you thoughts on this solution.

Windows Log: 
==========================================
POST /wd/hub/session HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 608
Content-Type: application/json; charset=utf-8
User-Agent: selenium/3.141.59 (java windows)
X-Idempotency-Key: d6d6262f-2ab4-4ebb-8e89-2de278e6bb1e

{
  "desiredCapabilities": {
    "app": "C:\\Windows\\System32\\notepad.exe",
    "driverClass": "io.appium.java_client.windows.WindowsDriver",
    "takesScreenshot": true,
    "javascriptEnabled": true,
    "platformName": "Windows",
    "cssSelectorsEnabled": true
  },
  "capabilities": {
    "firstMatch": [
      {
        "appium:app": "C:\\Windows\\System32\\notepad.exe",
        "cssSelectorsEnabled": true,
        "driverClass": "io.appium.java_client.windows.WindowsDriver",
        "javascriptEnabled": true,
        "platformName": "windows",
        "takesScreenshot": true
      }
    ]
  }
}
HTTP/1.1 404 Not Found


SampleTest.java
application.properties

Chirag Jayswal

unread,
Sep 23, 2021, 1:16:16 AM9/23/21
to qaf users
Was appium running and did you provided correct ip and port in properties file? Make sure you have correct value for remote.server and remote.port.
 If yes Can you share detailed log from execution console as well as from appium.



--
You received this message because you are subscribed to the Google Groups "qaf users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qaf-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qaf-users/6f08c49b-6d32-43d7-b884-6c843c719a93n%40googlegroups.com.

Mohamed Rafeek M

unread,
Sep 24, 2021, 1:36:05 AM9/24/21
to qaf users
Hi Jaiswal,
PFA the log information.
application.properties:
remote.server=127.0.0.1
remote.port=4723
driver.name=appiumDriver
appium.capabilities.driverClass=io.appium.java_client.windows.WindowsDriver
appium.capabilities.app=C:\\Windows\\System32\\notepad.exe

Testclass:
        System.out.println("Enter into np");       
//getDriver().verifyTitle(exact("Untitled - Notepad"));
new WebDriverTestBase().getDriver().getUnderLayingDriver().getTitle().contentEquals("Untitled - Notepad");
//getDriver().findElementByClassName("Edit").sendKeys("it worked!...")
$("className=Edit").sendKeys("it worked!...");
System.out.println("Exit into np");

Note: 
Issue: Notepad is not getting open automatiocally and WindowsDriver log getting trigger twice in each time. please refer attachement.
WindowsDriver_log.txt
Message has been deleted

Mohamed Rafeek M

unread,
Sep 24, 2021, 6:55:34 AM9/24/21
to qaf users
Attached eclipse log. 
Eclipse_Log.txt

Mohamed Rafeek M

unread,
Sep 28, 2021, 6:11:47 AM9/28/21
to qaf users
Hi Jaiswal.
I have attached appium log. Kindly verify and revert me if anything needs to be updated.

appium-server-logs.txt
Reply all
Reply to author
Forward
0 new messages