Ask a Question

Use ObjectIdentifier property with QuerySelector


Use ObjectIdentifier property with QuerySelector

Hello, I am using a desktop version of a web application, and when I use the Object Spy I can recognize different buttons, and dropdowns, etc.

These objects have a unique "ObjectIdentifier" property, but they don't have an ID. On the methods of all the objects inside the application, I can also see the "QuerySelector" as an option available.

My question is: How can I use the ObjectIdentifier property inside the QuerySelector method? I have already tried the following:

Assuming "ObjectIdentifier" = "uniqueOI"


page.QuerySelector("[ObjectIdentifier=uniqueOI]") <- does not return an object

page.QuerySelector("[id=uniqueOI]") <- does not return an object

page.QuerySelector("#uniqueOI") <- does not return an object


Anyone has any idea of how to make the QuerySelector work to find an object by it's object identifier property?



Community Leader


I have used queryselector to operate in web. It can work.

But I haven't  used it in Desktop App.


You can check the link QuerySelector Method in detail.

I hope it could be helpful.

SmartBear Alumni (Retired)

Thank you for the advice, Steven!


@TCYKPB Does this help?

Sonya Mihaljova
Community and Education Specialist

hello @sonya_m, no, unfortunately the reply had nothing to do with my question (except for the fact that the word "QuerySelector" is mentioned both in my post and the reply). 

Anyway, after several attempts I concluded that it is not possible to use the ObjectIdentifier property in the QuerySelector method.

I'll have to keep using the default FindObject method (which is terribly slow), until I can request to modify the HTML code of our application to insert the proper IDs so I can switch to the QuerySelector as my default method to find elements.

SmartBear Alumni (Retired)

Got it! Thank you for getting back @TCYKPB and sharing the solution with us! 

Sonya Mihaljova
Community and Education Specialist


out of my own curiosity, is this an electron or CEF desktop app that youre testing?

currently, i dont think neither findelement nor queryselector will work on those apps


Justin Kim
Showing results for 
Search instead for 
Did you mean: