views:

119

answers:

3

I want to know how could I write a program in C# that opens a browser and go to google.com (I did that easily)

I want to write code to automate move mouse to the input text field, click the mouse and then enter some text. move mouse to search button and hit it.

I know I should deal with iAccessible interface but I did not find any useful source.

Any help will be appreciated.

+2  A: 

All the stuff you're describing is possible with Watin. It doesn't do it via mouse moves, but by interacting directly with the browser at an API level. It supports Internet Explorer and Firefox.

Jason Punyon
Watin (and Watir before it) are both awesome for browser automation. Can't +1 enough.
BioBuckyBall
Actually I want a lower level than this. I found more than one library, but I want to know how does these libraries deal with ui Accessible interface that all ui elements should be implementing.
Mohammad Abdelaziz
+1  A: 

Look at the Windows Automation API: http://msdn.microsoft.com/en-us/library/ms726294(VS.85).aspx

and the Test API: testapi.codeplex.com which has some related packages you'll likely need. Sorry, can't post more than one link yet, but add the usual bits to get to the TestAPI site on codeplex.

mmDonuts
A: 

Hi Mohammed,

If you're looking to understand UI Automation, I've just started that myself. I wrote this project so that other people could use it or understand themselves too:

http://code.google.com/p/wipflash/

Mostly it's based around the Patterns and Properties. You can see how I've used the Patterns here:

http://code.google.com/p/wipflash/source/browse/#hg/WiPFlash/Framework/Patterns

Hope it helps.

(Edit: I also answered a similar question here: http://stackoverflow.com/questions/2920593/3037463#3037463 - you're probably looking for the ValuePattern).

Lunivore