Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to find a specific WpfControl for use in Coded UI tests
    primarykey
    data
    text
    <p>I'm trying to create some Coded UI tests to be used many times over a "set" of WPF controls. I can use the Coded UI test builder to create each test individually, but I am looking to create the "general" case, since each test is very similar, with slight modifications.</p> <p>In order to create this general case, I need to be able to find (then click) a control given the parent (in this case, a <code>WpfWindow</code>; the control I am looking for is a few levels deep, but I want to be able to find the control regardless of depth). I have been able to find the control I'm looking for using <code>AutomationElement</code>, but coded UI doesn't seem to like it, and I am unable to click it once found.</p> <p>I've tried using <code>GetChildren()</code> on the parent window and then recursively searching to find the control in question as well. I am using the <code>SearchProperties</code> to look for the <code>Name</code> and <code>ControlType</code> of the specific WPF control I'm looking for, but it doesn't look like everything has a <code>Name</code> and it fails out.</p> <p>I've also tried just setting the <code>SearchProperties</code> for the specific control, but it throws an exception saying it cannot be found. </p> <p>Any suggestions? Am I going about this the right way, or am I missing something fundamental?</p> <p>An aside to this is: how "bad" is it to have similar Coded UI tests built with the Coded UI test builder? What I mean is, it seem wrong to create 800 different tests using the Coded UI Test Builder that all have the same first 5 steps (with minor differences based on where it is run).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload