Anyone know how to find windows in the 2.0 preview?
Previous Versions had the Application Class.
Ranorex 2.0 and finding Windows
-
- Posts: 17
- Joined: Tue Dec 02, 2008 10:09 am
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
trying to do the same thing here since CreateAdapterForPath method is no longer available..
what is RepositoryName.MainForm?
the following code doesn't find anything, what am I doing wrong?
what is RepositoryName.MainForm?
the following code doesn't find anything, what am I doing wrong?
Code: Select all
Host host = Host.Local;
RxPath path = new RxPath("/form[@title='Ranorex Documentation']");
Element elm = host.Element.FindSingle(path, 1000);
if (elm != null)
MessageBox.Show(elm.Role.ToString());
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
The CreateAdapterForPath method is an internal method that should be used by generated repositories only. That's why we made it protected. There are much simpler ways to search for elements/adapters:
All methods searching for a single element/adapter throw an exception if no element is found. So, there is no need to check for null anymore.
The code you posted should work, though, did you load the default plugins by calling PluginManager.LoadDefaultPlugins()?
Regards,
Alex
Ranorex Support Team
Code: Select all
Form form = "/form[@title='Ranorex Documentation']";
// or use the Host adapter
form = Host.Local["Ranorex Documentation"];
// or if you want to specify a timeout for a path
form = Host.Local.FindSingle<Form>("/form[@title='Ranorex Documentation']", 1000);
That's code from a generated repository. RepositoryName.MainForm is not part of the Ranorex core interface.taralex wrote:what is RepositoryName.MainForm?
The code you posted should work, though, did you load the default plugins by calling PluginManager.LoadDefaultPlugins()?
Regards,
Alex
Ranorex Support Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact: