Hasher

Trouble identifying a form in IE

10 posts in this topic

#1 ·  Posted

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted

Have you tried something like:

$oForm = _IEGetObjById($oIE, "ct101")
$oSelect = _IEFormElementGetObjByName($oForm, 'ctl00$ContentPlaceHolder1$RadPanelBar1$i0$i8$ProductLine')

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

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!

Share this post


Link to post
Share on other sites

#4 ·  Posted

Does the website use frames?

Can you provide a URL or a full HTML listing?

Share this post


Link to post
Share on other sites

#5 ·  Posted

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!

Share this post


Link to post
Share on other sites

#6 ·  Posted

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")

 

Share this post


Link to post
Share on other sites

#7 ·  Posted

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")

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

Hmm not sure if the site has been updated because I was getting the same error as Hasher using the code in his OP, however the code in his OP is now working as well.

Share this post


Link to post
Share on other sites

#9 ·  Posted

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!

Share this post


Link to post
Share on other sites

#10 ·  Posted

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?

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