Sign in to follow this  
Followers 0
Bhavitha

To click the upload button using ControlClick without using co-ordinates

9 posts in this topic

Hi,

I am a new user to Auto IT, I am using Selenium to automate my application.

But as Selenium does not supports Modal pop ups and File upload, I am using Auto it to handle it.

I used Autoit Info to find the properties inorder to click the upload button,

Below is the summary of it:

>>>> Window <<<<

Title: ClientInbox - Mozilla Firefox

Class: MozillaUIWindowClass

Position: -4, -4

Size: 1288, 972

Style: 0x15CF0000

ExStyle: 0x00000100

Handle: 0x000205E6

>>>> Control <<<<

Class: MozillaWindowClass

Instance: 5

ClassnameNN: MozillaWindowClass5

Name:

Advanced (Class): [CLASS:MozillaWindowClass; INSTANCE:5]

ID:

Text:

Position: 0, 114

Size: 1280, 802

ControlClick Coords: 976, 637

Style: 0x56000000

ExStyle: 0x00000000

Handle: 0x000608FE

>>>> Mouse <<<<

Position: 976, 777

Cursor ID: 0

Color: 0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

I used :- WinActivate("ClientInbox - Mozilla Firefox", "")

ControlClick("ClientInbox - Mozilla Firefox", "", "[CLASS:MozillaUIWindowClass;INSTANCE:1]","","1","984","750")

But it is not working. Can someone help me with this.

I used :- MouseClick("left",964,743,1) but this does not works as the mouse position changes.

Also wherever i place the Finder Tool of Autoit info, it is showing the same class and it is capturing the entire screen.( not as Class:button )

Kindly can someone help me with this with an example script.

Thanks in advance

Regards

Bhavitha

Share this post


Link to post
Share on other sites



Hi

Use the Info Tool to identify the handle of the button you wish to click and then use the ControlClick command to click it. I've always found that just passing the function the handle is enough, you don't have to supply all those extra paramaters.

Hope that helps.

Share this post


Link to post
Share on other sites

Hi

Use the Info Tool to identify the handle of the button you wish to click and then use the ControlClick command to click it. I've always found that just passing the function the handle is enough, you don't have to supply all those extra paramaters.

Hope that helps.

Hi,

Thanks a lot for your response.

As i have mentioned before, the AutoIt is not showing different properties for different buttons on the screen. It is capturing the entire screen with same properties except the mouse positions as shown below. It is not pointing to individaul button.

(this is with Mozilla)

Title: ClientInbox - Mozilla Firefox

Class: MozillaUIWindowClass

Position: -4, -4

Size: 1288, 972

Style: 0x15CF0000

ExStyle: 0x00000100

Handle: 0x00241002

The same i tried with my application in InternetExplorer, even there it is capturing entire screen with the below properties( also it is taking as IEframes) so does autoit supports for IEframes?

Title: ClientInbox - Windows Internet Explorer

Class: IEFrame

Position: -4, -4

Size: 1288, 972

Style: 0x15CF0000

ExStyle: 0x00000100

Handle: 0x00420E72

Can you please tell us how to use the handle and pass it and use ControlClick to click the button(syntax or any example).It will be really helpful :graduated:

Thank you

Regards,

Bhavitha

Share this post


Link to post
Share on other sites

So let me get this, the AutoInfo does not ID the control when you drag the target icon over the button? If this is the case then you'll need to look at the source of the page and find the reference to the control. You should be able to find it's ID and/or Name. Once you've located this then you can click it.

Share this post


Link to post
Share on other sites

So let me get this, the AutoInfo does not ID the control when you drag the target icon over the button? If this is the case then you'll need to look at the source of the page and find the reference to the control. You should be able to find it's ID and/or Name. Once you've located this then you can click it.

Yes, You are right. It does not show the control

This is the Page source, for the button Upload document.

<tr>

<td class="ar">

<input type="button" name="previewletter" id="previewletter" value="Preview Letter" class="btn_srch" onclick="previewLetter();">

<input type="button" name="Submit" value="Reset" class="btn_srch" onclick="resetForm();">

<span class="myStyle">

<input type="button" Class="btn_srch" name="cmdClientFeild" tabindex="39" value="Client Fields" onclick="openClientFieldsWin()">

<!--<input type="button" Class="btn_srch" name="cmdPreview" tabindex="39" value="Preview Letter">-->

<input type="button" Class="btn_srch" name="cmdIdentity" tabindex="39" value="Add Identity" onclick="openwinposition()">

<input type="button" name="Submit" value="Upload Document" class="btn_srch" onclick="uploadDocument();">

<input type="button" name="submitcreatecase" value="Create Case" class="btn_srch" onclick="submitForm();">

</td>

</tr>

The underlined code is the one which i need to click.

Can u tell me the syntax how do i click it using commands of Autoit(contolclick)

Thanks a lot :graduated:

Share this post


Link to post
Share on other sites

Yes, You are right. It does not show the control

This is the Page source, for the button Upload document.

<tr>

<td class="ar">

<input type="button" name="previewletter" id="previewletter" value="Preview Letter" class="btn_srch" onclick="previewLetter();">

<input type="button" name="Submit" value="Reset" class="btn_srch" onclick="resetForm();">

<span class="myStyle">

<input type="button" Class="btn_srch" name="cmdClientFeild" tabindex="39" value="Client Fields" onclick="openClientFieldsWin()">

<!--<input type="button" Class="btn_srch" name="cmdPreview" tabindex="39" value="Preview Letter">-->

<input type="button" Class="btn_srch" name="cmdIdentity" tabindex="39" value="Add Identity" onclick="openwinposition()">

<input type="button" name="Submit" value="Upload Document" class="btn_srch" onclick="uploadDocument();">

<input type="button" name="submitcreatecase" value="Create Case" class="btn_srch" onclick="submitForm();">

</td>

</tr>

The underlined code is the one which i need to click.

Can u tell me the syntax how do i click it using commands of Autoit(contolclick)

Thanks a lot :graduated:

I tried with :

WinActivate("ClientInbox - Mozilla Firefox","")

ControlClick("ClientInbox - Mozilla Firefox", "", "[CLASS:btn_srch;NAME:Submit;TEXT:Upload Document]")

But it did not work.

Do we have to move the focus or handle to it. Please help me with the commands to do it.

Thank you.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hi,

I was also encountered same problem and i resolve it as :

First activate ff/ie browser using its title, then getting position of applet and apply mouse click by adding some value in position because buttons are present somewhere on the applet.

$title = WinGetTitle("Mozilla Firefox")
WinActivate($title);
Sleep(2000)
$pos = ControlGetPos($title, "", "[CLASS:MozillaWindowClass; INSTANCE:7]")
MouseClick("left", $pos[0]+73, $pos[1]+311, 2)

May be its help for you.

Thanks,

Ravi

Edited by RaviJ

Share this post


Link to post
Share on other sites

Hi,

I was also encountered same problem and i resolve it as :

First activate ff/ie browser using its title, then getting position of applet and apply mouse click by adding some value in position because buttons are present somewhere on the applet.

$title = WinGetTitle("Mozilla Firefox")
WinActivate($title);
Sleep(2000)
$pos = ControlGetPos($title, "", "[CLASS:MozillaWindowClass; INSTANCE:7]")
MouseClick("left", $pos[0]+73, $pos[1]+311, 2)

May be its help for you.

Thanks,

Ravi

Hi Ravi,

Thanks for your help :graduated:

Share this post


Link to post
Share on other sites

Hi Bhavitha,

I'm facing the same problem. Were you able to arrive at some conclusion?


Learning is Lifelong!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0