diikee Posted June 18, 2008 Share Posted June 18, 2008 expandcollapse popupSleep(2000) $gs = _IETagNameGetCollection ($oIE, "select") For $g In $gs If ($g.name) = "gainStyle" then $gopt = _IETagNameGetCollection($g, "OPTION") For $gop in $gopt Sleep(2000) ConsoleWrite($g.name & " Type: " & $gop.innerText & @CRLF) ;MsgBox(0, "Selection Values", "Name: " & $oInput.name & " Type: " & $op.innerText) FileWrite($file, "Gain style: " & $g.name & " Type: " & $gop.innerText & @CRLF) Global $o = $gop.innerText ConsoleWrite("Gain style set to: " & $o & @CRLF) _IEFormElementOptionselect($g, $o, 1, "byText") FileWrite($file, "Gain style set to: " & $o & @CRLF) Sleep(2000) _IENavigate($oIE, &$ip "/get.oid?1.2.8.14") Sleep(3000) ;ConsoleWrite("Got Here1" & @CRLF) $oid = _IEAttach(&$ip "/get.oid?1.2.8.14","URL") Sleep(1000) $gm = _IETagNameGetCollection($oid, "PRE") Sleep(1000) For $g in $gm $id = $g.innerText ;ConsoleWrite("Got Here2" & @CRLF) ConsoleWrite("GainStyle is set to: " & $id & @CRLF) ;ExitLoop Next If $id = $o Then ConsoleWrite("GainStyle set successfully" & @CRLF) Else ConsoleWrite("GainStyle set test failed" & @CRLF) EndIf Sleep(2000) _IENavigate($oIE, $ip) Sleep(1000) _IELinkClickByText($oIE, "settings", 0, 0) Sleep(1000) _IELinkClickByText($oIE, "image") Sleep(2000) $gs = _IETagNameGetCollection ($oIE, "select")---->>>IS THIS POSSIBLE from here For $g In $gs If ($g.name) = "gainStyle" then $gopt = _IETagNameGetCollection($g, "OPTION") For $gop in $gopt Next EndIf Next----------------------------------------------------->>>To here<<<<------- Next ExitLoop EndIf Next Sleep(3000)C:\autoit\IQSQA_Test.au3 (781) : ==> The requested action with this object has failed.:ConsoleWrite($g.name & " Type: " & $gop.innerText & @CRLF)ConsoleWrite($g.name & " Type: " & $gop.innerText ^ ERRORI wan't to navigate to another page then browse to the previous page within a FOR LOOP to avoid the error above on the 2nd pass or iteration. (see -------->>>>>>>> in the script) Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 18, 2008 Share Posted June 18, 2008 C:\autoit\IQSQA_Test.au3 (781) : ==> The requested action with this object has failed.:ConsoleWrite($g.name & " Type: " & $gop.innerText & @CRLF)ConsoleWrite($g.name & " Type: " & $gop.innerText ^ ERRORI wan't to navigate to another page then browse to the previous page within a FOR LOOP to avoid the error above on the 2nd pass or iteration. (see -------->>>>>>>> in the script)It just doesn't work that way. When you navigate away from the current page the old DOM and all it's objects go away, to be replaced by the new DOM for the navigated page. Even if you navigate back to the same page, all the parts will have new object references (even if you do "Back" I believe). 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 More sharing options...
Moderators big_daddy Posted June 19, 2008 Moderators Share Posted June 19, 2008 You can create a second IE object and navigate using that one. Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 19, 2008 Share Posted June 19, 2008 You can create a second IE object and navigate using that one.Good point. Another instance of IE, or another Tab if you're using IE7. 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 More sharing options...
diikee Posted June 24, 2008 Author Share Posted June 24, 2008 expandcollapse popupSleep(2000) $gs = _IETagNameGetCollection ($oIE, "select") For $g In $gs If ($g.name) = "gainStyle" then $gopt = _IETagNameGetCollection($g, "OPTION") For $gop in $gopt Sleep(2000) Global $o = $gop.innerText ConsoleWrite("Gain style is: " & $o & @CRLF) _IEFormElementOptionselect($g, $o, 1, "byText")------>>>this is where it errors out. can you see loop issues? FileWrite($file, "Gain style is: " & $o & @CRLF) Sleep(2000) $oi = _IECreate($ip, 0) _IELoadWait($oi) _IENavigate($oi, &$ip "/get.oid?1.2.8.14") Sleep(3000) $oid = _IEAttach(&$ip "/get.oid?1.2.8.14","URL") Sleep(1000) $gm = _IETagNameGetCollection($oid, "PRE") Sleep(1000) For $g in $gm $id = $g.innerText ConsoleWrite("GainStyle is set to: " & $id & @CRLF) Next If $id = $o Then ConsoleWrite("GainStyle set successfully" & @CRLF) Else ConsoleWrite("GainStyle set test failed" & @CRLF) EndIf Sleep(2000) WinClose($oid) Sleep(1000) $oIE = _IEAttach(&$ip "/imageset.html","URL") Sleep(3000) Next ExitLoop EndIf Next Sleep(3000)the script works fine but in the 2nd pass, it lists the selection item but never selects it.Gain style is: darkdetect--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidObjectTypeGainStyle is set to: PEAKDETECTGainStyle set test failedGain style is: average--> IE.au3 V2.4-0 Error from function _IEFormElementOptionselect, $_IEStatus_InvalidObjectTypeGainStyle is set to: PEAKDETECTGainStyle set test failedHOW DO I GET IT to select the option avaialable??? Link to comment Share on other sites More sharing options...
DaleHohm Posted June 25, 2008 Share Posted June 25, 2008 Is the page changing at all while you are doing this? You might want to put in some ConsoleWrite debugging statements to, for example, look at ObjName($g) and $o. Also might want a _IELoadWait priot to that function call at least for debugging. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
diikee Posted June 25, 2008 Author Share Posted June 25, 2008 1. Create a page and select some option 2. Create another page inside the script in (1) and verify the selection option took effect and close that page (2) 3. I then re_attach to (1) and try to select the next available option With the print statements, it seems to locate all the selection options but they never get selected ----->>>is this possible to do that?? 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