Jump to content

Select Option


smita
 Share

Recommended Posts

Hi, I have written one script as below after login into application it will open main page. In main page I have to click on image it will open one new page configuration page, there I have to select value from drop down box.

#include <IE.au3>

$oIE = _IECreate("http://12.44.178.190/login.php")

WinSetState("","",@SW_MAXIMIZE)

_IELoadWait($oIE)

Sleep(1000)

$o_Username = _IEGetObjByName($oIE ,"login")

_IEFormElementSetValue ($o_Username ,"admin")

$o_Password = _IEGetObjByName($oIE ,"password")

_IEFormElementSetValue ($o_Password ,"admin")

$o_Connect = _IEGetObjByName($oIE ,"btnconnect")

_IEAction($o_Connect ,"click")

_IELoadWait($oIE) // Opens main page

_IEImgClick($oIE,"images/setup.gif","src") // In main page have to click on image

Sleep(7000)

_IELoadWait($oIE) // Opens Configuration page

WinSetState("","",@SW_MAXIMIZE)

MouseClick("Left" ,231,207)

Sleep(4000)

$o_Select = _IEGetObjById($oIE,"Devtype")

_IEFormElementOptionselect($o_Select,"User",1,"byText") //Have to select "User" Option from drop down.

But it's not selecting "User" option. Object ID is correct even have tried with Object name.

Can you please tell me As option is in the third page of Application that's why it's not able to indentify?

Link to comment
Share on other sites

Couple of things:

The comment character in AutoIt is a semicolon ";" not double forwardslash "//".

Are you sure the page is ready? I ask because of the blind MouseClick() and Sleep() just before _IEFormElementOptionselect().

Add _IEErrorHandlerRegister() near the top of your script so you get more information.

You can also get the values of @error and @extended after the _IEFormElementOptionselect(), per the help file:

Return Value

Success: If $f_select = -1, returns the current selected state, else returns 1

Failure: Returns 0 and sets @ERROR

@Error: 0 ($_IEStatus_Success) = No Error

3 ($_IEStatus_InvalidDataType) = Invalid Data Type

4 ($_IEStatus_InvalidObjectType) = Invalid Object Type

5 ($_IEStatus_InvalidValue) = Invalid Value

7 ($_IEStatus_NoMatch) = No Match

@Extended: Contains invalid parameter number

:)

Edit: Typos

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Couple of things:

The comment character in AutoIt is a semicolon ";" not double backslash "\\".

Are you sure the page is ready? I ask because of the blind MouseClick() and Sleep() just before _IEFormElementOptionselect().

Add _IEErrorHandlerRegister() near the top of your script so you get more information.

You can also get the values of @error and @extended after the _IEFormElementOptionselect(), per the help file:

:)

Hi,Thanks for reply.

Ya I know how to put comments. Don't consider mouse click & sleep.

As per my script it will open browser called "login" after that we are going to "Set up" page but script is not able to identify that "Set up" page as $oIE value will change.

How to combine this "Set up" page with existing IE page?

Link to comment
Share on other sites

Hi,Thanks for reply.

Ya I know how to put comments. Don't consider mouse click & sleep.

As per my script it will open browser called "login" after that we are going to "Set up" page but script is not able to identify that "Set up" page as $oIE value will change.

How to combine this "Set up" page with existing IE page?

Is it opening a new browser window? Then use _IEAttach() to get the browser object for that one.

If this "Set up" page opens in the same browser, then $oIE is still valid.

There are also gimmicks for working with Tabs in IE7, but you'll have to do some searching for that because I haven't had occasion to use it yet.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...