Jump to content

Trouble identifying a form in IE


Recommended Posts

Hey all I am trying to select a drop down box in a webpage and make a selection. Do this easy in the past but this page is making it hard .Cut down my code significantly for this post.

Seems to be only one form on the page and only has an ID but no name 
 

#ctl01<form method="post" action="./productSearch.aspx" id="ctl01">

Can someone tell me what I am doing wrong?

 

current error is :

 

--> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch




 

#include <IE.au3>

Local $oIE = _IECreate("http://www.dmcretail.com/RetailSelect.aspx")
Local $oSubmit = _IEGetObjByName($oIE, "btnCase")
_IEAction($oSubmit, "click")
;~ loads to http://www.dmcretail.com/productSearch.aspx
_IELoadWait($oIE)


$oForm = _IEFormGetCollection($oIE, 0)
$oSelect = _IEFormElementGetObjByName($oForm, 'ctl00$ContentPlaceHolder1$RadPanelBar1$i0$i8$ProductLine')

 

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

Hi Subz that was my first try.   That thows this error

 

--> IE.au3 V2.4-0 Warning from function _IEGetObjById, $_IEStatus_NoMatch (ct101)

 

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

http://www.dmcretail.com/RetailSelect.aspx

select a button and it goes to a product listing page
 

http://www.dmcretail.com/productSearch.aspx

 It does have a form .I want to select a dropdown box. Seems objects have a ID but not a name

 

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

You need to use _IEAttach to get the new window in the example below, I've used hwnd, but you could use title etc.. as well by changing _IEPropertyGet

#include <IE.au3>

Local $oIE = _IECreate("http://www.dmcretail.com/RetailSelect.aspx", 1)
Local $hWnd = _IEPropertyGet($oIE, "hwnd")
Local $oSubmit = _IEGetObjByName($oIE, "btnCase")
_IEAction($oSubmit, "click")

;~ Product Search Page
$oIE = _IEAttach($hWnd, "hwnd")
_IELoadWait($oIE)
$oForm = _IEFormGetCollection($oIE, 0)
$oSelect = _IEFormElementGetObjByName($oForm, 'ctl00$ContentPlaceHolder1$RadPanelBar1$i0$i8$ProductLine')
_IEAction($oSelect, "focus")

;~ Select by value
_IEFormElementOptionSelect($oSelect, 17)
;~ Or Select by text
_IEFormElementOptionSelect($oSelect, "Dozers", 1, "byText")

 

Link to comment
Share on other sites

1 hour ago, Subz said:

You need to use _IEAttach to get the new window in the example below, I've used hwnd, but you could use title etc.. as well by changing _IEPropertyGet

Actually, it appears to work without needing the _IEAttach. Here's my solution:

#include <IE.au3>

$oIE = _IECreate('http://www.dmcretail.com/RetailSelect.aspx')
$oButton = _IEGetObjById($oIE, 'btnCIH')
_IEAction($oButton, 'click')
_IELoadWait($oIE)

$oForm = _IEFormGetCollection($oIE, 0)
$oSelect = _IEFormElementGetObjByName($oForm, "ctl00$ContentPlaceHolder1$RadPanelBar1$i0$i8$ProductLine")

_IEFormElementOptionSelect($oSelect, "Balers", 1, "byText")

 

Link to comment
Share on other sites

Hi Subz and Danp2 .No luck with either of your code , even tried going back to my original . Seems Auto-it can't handle this adequately . Will try in JavaScript 

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

3 hours ago, Hasher said:

Hi Subz and Danp2 .No luck with either of your code , even tried going back to my original . Seems Auto-it can't handle this adequately . Will try in JavaScript 

Not sure why it isn't working for you. As Subz mentioned, all three posted versions are working for me.

What OS and version of IE are you using?

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...