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

window.Get<Buttons> ByText not working! Please help me! #656

Open
gaslix opened this issue Sep 29, 2019 · 0 comments
Open

window.Get<Buttons> ByText not working! Please help me! #656

gaslix opened this issue Sep 29, 2019 · 0 comments

Comments

@gaslix
Copy link

gaslix commented Sep 29, 2019

Dear,

I'm beginner with C# and White, and I'm trying to automate a very stupid action => Click on the "New" button in Notepad++.
Challenge, I'm building a DLL => I use that DLL in Automation Anywhere (Metabot).

Here is my DLL code :

using System;
using System.Diagnostics;
using System.Windows;
using TestStack.White;
using TestStack.White.WindowsAPI;
using TestStack.White.UIItems;
using TestStack.White.UIItems.Finders;

namespace MyAADLL
{
public class MyAAClass
{
public static void ClickButton2(string procName, string applicLaunch, string applicAttach, string getWin, string automationId)
{
Application application;
Process[] processes = Process.GetProcessesByName(@procname);
if (processes.Length == 0)
{
application = Application.Launch(@applicLaunch);
}
else
{
application = Application.Attach(@applicAttach);
}
TestStack.White.UIItems.WindowItems.Window window = application.GetWindow(getWin);
TestStack.White.UIItems.Button button = window.Get<TestStack.White.UIItems.Button>(TestStack.White.UIItems.Finders.SearchCriteria.ByText(automationId));
button.Click();
}
}
}

I'm trying to make the ClickButton2 function working.

Actually, I provide "notepad++" as value for procName, applicLaunch, applicAttach, "new 5 - Notepad++" as value for getWin and "New" for automationId.

The script is failing when it comes to "TestStack.White.UIItems.Button button = window.Get<TestStack.White.UIItems.Button>(TestStack.White.UIItems.Finders.SearchCriteria.ByText(automationId));".

Could one of you help me with that ? I'm sure for you it's gonna be easy to solve ;-)

Thanks!

Augustin

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

No branches or pull requests

1 participant