Selector for Element of App in MS Visual Studio changed

Hi, folks.

We’re automating against an application that another team is working on in Microsoft Visual Studio. They released a new version a few days ago that broke our automation because the ctrl name of the element changed from “FileID Row 0” to “FileID Row 0, Not sorted.” They said that they didn’t make that change, but it’s there. When we spied around the old and new versions, we could tell that all cells in all tables not had “, Not sorted.” appended to the ends of their names.

The entire selector was actually different, too:
OLD:
<ctrl name=‘FileID Row 0’ aastate=‘selected, focused, focusable, selectable’ helpText=‘DataGridViewTextBoxCell(DataGridViewCell)’ role=‘cell’ text=‘3400’ />

NEW:
<ctrl automationid=‘423056034’ aastate=‘selected, focused, read only, focusable, selectable’ name=‘FileID Row 0, Not sorted.’ role=‘cell’ text=‘3400’ />

There is now an “automationid” attribute and no longer a “helpText” attribute. I’m not sure what caused this change to occur, but it did.

Anyone know what might cause a change like this?

It’s common for things to change when applications/web sites are upgraded. That’s why it’s important to do the update in QA first, and test your relevant automations before doing the upgrade in production.

Yeah, it would make sense for the updates to be in QA first for us to test against before it went into Prod, right? That’s what I told them, too, ha.

1 Like

Also, using attributes like aastate in your selectors can be problematic because a simple state change can break the automation, even though it shouldn’t. Just because an element, for a normal part of how the page displays, goes from focused to not focused would change the selector. You always want to look for and only use - if possible - stable attributes.

Oh, for sure, 100%. We are only using the name for this selector:

OLD:
<ctrl name=‘FileID Row 0’ />

NEW:
<ctrl name=‘FileID Row 0, Not sorted.’ />

The name usually doesn’t change, but in this case it did. Trying to find out why that change occurred (without them explicitly changing it), but also wondering why the other attributes would be different, too.