Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Is there a console-like environment where I can test finding (or interacting with) elements #915

Open
jpc1963 opened this issue Oct 15, 2019 · 11 comments

Comments

@jpc1963
Copy link

jpc1963 commented Oct 15, 2019

Hi,
Is there a way to test commands like FindElementsByName. This is a simple example but if I want to find an element in a list which contains another specific element which contains some text, then it would be handy to test this code in a console-like environment. Rather than running my test until I get it right.
Anybody who is used to Xamarin UITesting will have access to a REPL (a console which can be used to interact with you app).
Something similar would be very handy here. I am new to WinAppDriver and am trying to extend existing ios/android Xamarin UITests tests to enable me to test Windows apps.

@naeemakram
Copy link

You can use WinAppDriverUI Recorder to find control properties but there's no dedicated console for doing what you want to do. It is an interesting idea though.

@naeemakram
Copy link

If you want to use a Shell like interface, maybe you could leverage existing Python support of WinAppDriver.

@naeemakram
Copy link

On a secondary note, it should be possible to be done through Node.js as well. I tried but couldn't make it work.
Here's a thread about running WinAppDriver in Node.js, maybe it will be helpful for you.
#626

@licanhua
Copy link
Contributor

I suggest you to use appium-desktop.
Personally I think it's better than Inspect.exe, also over UI Recorder in interacting.
Although it doesn't provides REPL, but you can use XPath.
Please refer to Interactive Search part of Inspecting UI Elements for WinAppDriver automation using Appium Desktop

@anunay1
Copy link

anunay1 commented Oct 18, 2019

@licanhua Does the latest version of appium desktop work for you, because it does not work with the version 1.1. #800

image

@naeemakram
Copy link

In my case I didn't run the Appium Desktop but I faced a similar error while trying to run WinAppDriver through Node.js code.
Take a look at the following.

let WindowsDriver = require('appium-windows-driver').WindowsDriver;

let defaultCaps = {
  platformName: 'Windows',
  deviceName: 'WindowsPC',
  app: 'C:\\Windows\\System32\\notepad.exe'
};

async function main() {
  let driver = new WindowsDriver();
  await driver.createSession(defaultCaps);
  let element = await driver.findElement('//*[@ClassName="Edit"]');
//  element.SendKeys("This is some text");
}
main();	

Error screenshot is given below, it also says re-run install.
winappdriver-error

@jpc1963
Copy link
Author

jpc1963 commented Oct 18, 2019

Thanks for the comments. Shame about the REPL (or lack thereof).
I'll have a look at appium desktop. Hopefully its better that inspect.exe.
You can also use the immediate window in visual studio to test commands. Its a simple work around.

@naeemakram
Copy link

The Appium Deksop didn't open on my Windows 10 machine, I tried downloading multiple versions. I hope it works for you. WAD UI Recorder worked fine on my machine though.

@licanhua
Copy link
Contributor

For Appium Desktop, you may go back to "the server is running" to see which WinAppDriver you should install.
image

@naeemakram . For you question, it's because this PR: appium/appium-windows-driver#60
appium-windows-driver 1.7.0 or above is using WinAppDriver 1.2RC

@NathanZook
Copy link

I'm using an extension to my browser to test API calls as needed. RESTer on Firefox is mostly adequate. Do be warned: RESTer saves the results of all calls, so if you are using a root session and dump source, all of that data is now part of the source until you delete it.

@fenchu
Copy link

fenchu commented Dec 16, 2019

You could talk to the accessibiliyInsight guys and get them to implement a Xpath session, I've tried but they said it was not a priority, but if it get from you guys it would be carry more weight. And this is to replace inspect.exe in VisualStudio2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants