2. How does selenium web-driver interact with the browser? What makes your selenium code works?
Anoniem
Webdriver is an interface and its methods are implemented by respective browser drivers. These browser driver fetch the selenium commands from your test script and sends them over to browser driver which has its own HTTP server, that received the request. Understands it and creates a request in a way its browser can understand which is again sent to browser. Browser sends back its response to browser which in turn sends it your script.