Generally, I open some other's website in the browser, say google.com, type something in the search box then click search.

Is it impossible to write a program to do that and find something on the result page, instead of doing that manually?

I tried javascript but there seems no way to go around the same-origin restriction.

PS: Not only search, maybe I also need to input username, password and login.
Besides javascript, I'm using C#.