Hasher Posted April 16, 2017 Share Posted April 16, 2017 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 More sharing options...
Subz Posted April 16, 2017 Share Posted April 16, 2017 Have you tried something like: $oForm = _IEGetObjById($oIE, "ct101") $oSelect = _IEFormElementGetObjByName($oForm, 'ctl00$ContentPlaceHolder1$RadPanelBar1$i0$i8$ProductLine') Link to comment Share on other sites More sharing options...
Hasher Posted April 16, 2017 Author Share Posted April 16, 2017 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 More sharing options...
Danp2 Posted April 16, 2017 Share Posted April 16, 2017 Does the website use frames? Can you provide a URL or a full HTML listing? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Hasher Posted April 16, 2017 Author Share Posted April 16, 2017 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 More sharing options...
Subz Posted April 16, 2017 Share Posted April 16, 2017 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 More sharing options...
Danp2 Posted April 17, 2017 Share Posted April 17, 2017 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") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Subz Posted April 17, 2017 Share Posted April 17, 2017 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. Link to comment Share on other sites More sharing options...
Hasher Posted April 17, 2017 Author Share Posted April 17, 2017 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 More sharing options...
Danp2 Posted April 17, 2017 Share Posted April 17, 2017 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? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now