Send-Click Windows 7

Apr 19, 2011 at 10:31 PM

Hi, I just wanted to start out by saying that I have been doing windows automation for quite some time and I really appreciate finding your Snapin.

I am trying to figure out what the problem is with this code.

Select-Window chrome | Send-Click -button left -x 150 -y 45

When I do the above in a powershell window, the chrome window gets activated and nothing happens.  What should happen is there should be a single click in the address bar but there's not.

If I do the following code, chrome closes out as it should:

Select-Window chrome | Send-Click -button left -x 10 -y 10 -Double

Why does the first line of code not work and the second line of code works perfectly?  (I want to state that I am not trying to get the mouse to actually click in the address bar for me, i have a java button on another page that is in the same place every time and it kicks off a sequence of events that i will have to interact with but this is just one step in the process... phew.)

Oct 4, 2011 at 12:15 AM

I've had the same issue. I can't seem to get the Send-Click command to work at all though.

zhollett, did you happen to come to a solution for this?

Oct 4, 2011 at 5:49 AM

Usually when that happens it's because of how we're sending the click.  If you want to click the address bar, you have to actually find the address bar and click that (instead of sending the click to the top level window).

You're going to want to pipe your Select-Window chrome through Select-Control (or Select-Control -recurse) until you get the address bar and then send-click to that (I'd figure out the exact incantation of Select-Control for you, but I don't have Chrome).

As a side note, my preference for stuff like that is to use send-keys ...