Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to capture the VS .net objects using winapp driver #2024

Open
satishh107 opened this issue Aug 15, 2024 · 2 comments
Open

Unable to capture the VS .net objects using winapp driver #2024

satishh107 opened this issue Aug 15, 2024 · 2 comments

Comments

@satishh107
Copy link

Trying to automate visual studio .net application using winapp driver .

Installed appium.webdriver.package.

Steps to automate on VS.net
Click on-- File-->New-->Project

Steps to reproduce the issue:
1)Create a project (Unit test project .net framework)
2) add below code
3) run the test

sing Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using System;
using System.Threading;

namespace Mstest
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
System.Diagnostics.Process.Start
(@"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe");
AppiumOptions options = new AppiumOptions();
options.AddAdditionalCapability("app", @"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe");
options.AddAdditionalCapability("deviceName", "WindowsPC");

        var driver = new WindowsDriver<WindowsElement>
         (new Uri("http://127.0.0.1:4723"), options);
        Thread.Sleep(3000);
        driver.FindElementByName("Continue _without code").Click();
        driver.FindElementByXPath("//*[@ClassName='MenuItem'][@Name='Edit']").Click();
        driver.FindElementByXPath("//*[contains(@Name,'Edit')]").Click();
        driver.CloseApp();
    }
}

}

Error:
POST /session/359EF938-0771-4718-9545-B4B6FC4E58E3/element HTTP/1.1
Accept: application/json, image/png
Content-Length: 49
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.0 (.net windows)

{"using":"name","value":"Continue _without code"}
HTTP/1.1 200 OK
Content-Length: 102
Content-Type: application/json

{"sessionId":"359EF938-0771-4718-9545-B4B6FC4E58E3","status":0,"value":{"ELEMENT":"7.11380.59133445"}}

==========================================
POST /session/359EF938-0771-4718-9545-B4B6FC4E58E3/element/7.11380.59133445/click HTTP/1.1
Accept: application/json, image/png
Content-Length: 2
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.0 (.net windows)

{}
HTTP/1.1 200 OK
Content-Length: 63
Content-Type: application/json

{"sessionId":"359EF938-0771-4718-9545-B4B6FC4E58E3","status":0}

==========================================

POST /session/359EF938-0771-4718-9545-B4B6FC4E58E3/element HTTP/1.1
Accept: application/json, image/png
Content-Length: 68
Content-Type: application/json;charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.0 (.net windows)

{"using":"xpath","value":"//*[@classname='MenuItem'][@name='Edit']"}
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."}}

@liljohnak
Copy link

driver.FindElementByXPath("//*[@ClassName='MenuItem'][@Name='Edit']").Click()
Requires the element to be enabled and clickable.
Possible solution?:
Use FindElements and await the existence of the first element. Then click the control's boundingbox center.

@satishh107
Copy link
Author

driver.FindElementByXPath("//*[@ClassName='MenuItem'][@Name='Edit']").Click() Requires the element to be enabled and clickable. Possible solution?: Use FindElements and await the existence of the first element. Then click the control's boundingbox center.

Sorry, It didnt work.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants