Selenium is based on JQuery. When we write code in Java/C# or lanaguage of your choice, it is translated to JSON. Those JSONs are sent to selenium server. Server will parse those queries and convert those into associated JavaScript/JQuery and execute the samee on browser. Same way it identifies Object and returns path of the object.