Jump to content

talkfoodtalk

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by talkfoodtalk

  1. HI, I cannot work out how to connect to the input box on this link: https://cms.bskyb.2wire.com/manage/login My usual method is in my code but it does not seem to find the elements I need to connect with. I can see that "text" and "password" are on the page but im confused about putting input to it. Can someone point me in the right direction? Kind Regards Dave #include <IE.au3> #include <MsgBoxConstants.au3> $PACE = _IEAttach("https://cms.bskyb.2wire.com/manage/login", "url") If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "PACE not attached") $PACE =_IECreate("https://cms.bskyb.2wire.com/manage/login") EndIf $colForms = _IEFormGetCollection ($PACE ) For $oForm In $colForms $colElements = _IETagNameAllGetCollection ( $oForm ) For $oElement In $colElements If StringInStr ( $oElement.getAttribute ( "tkPid", 2 ), "PID19" ) <> 0 Then MsgBox(0, "Result", "Success") _IEFormElementSetValue($oElement, "username") ;~ _IEAction ( $oElement, "click" ) Else EndIf If StringInStr ( $oElement.getAttribute ( "__eventBits=", 2 ), "7409" ) <> 0 Then MsgBox(0, "Result", "Success") _IEFormElementSetValue($oElement, "password") ;~ _IEAction ( $oElement, "click" ) Else EndIf Next Next Local $oInputs = _IETagNameGetCollection($PACE, "input") Local $sTxt = "" For $oInput In $oInputs $sTxt &= $oInput.type & @CRLF if $oInput.type = "text" Then EndIf Next MsgBox($MB_SYSTEMMODAL, "Form Inqput Type", "Form: " & $oInput.form.name & @CRLF & @CRLF & " Types :" & @CRLF & $sTxt)
  2. Ta daaa!! Excellent!!! That works! I was pulling my hair out with that one. I did try somthing similar to that earlier however I was puting my parentheses in the wrong place. Thankyou soo much Danp2.
  3. Also _IEFormSubmit($oForm) does do somthing. It reloads the page that its on but it does not submit my input.......
  4. I added below in $na.Document.parentWindow.execScript("key = document.createEventObject(); key.keyCode = #{key}") $na.Document.parentWindow.execScript("document.getElementById('#{element_id}').fireEvent('onkeydown', key)") and $oText.fire_keydown_on($oForm, 13) But im still scratching my head. Any suggestions how I can send 'enter' or a cariage return?
  5. Hi Danp2 Sorry, I rushed that question. Yes I did try _IEFormSubmit($oForm) however that did not work. I'll do some research on ExecScript and let you know how it goes. Cheers!
  6. Hi I am trying to submit an IE Form: <FORM encType=multipart/form-data method=post name=menuForm action=/nac-cp/default.html><TABLE> <TBODY> <TR> <TD>Inspect:</TD> <TD><INPUT onkeydown="if (event.keyCode == 13) {do_menu_form_submit('quickSearch_searchFieldId_');return false;};" title="<accessNode>:<rackId>-<shelfId>-<slotId>-[iMA#/BOND#]<portId> / <label> / <Id> / LABEL=<portlabel> / LBL=<portlabel> / CLABEL=<customerlabel> / CLBL=<customerlabel> / INSP=<Id> / INSPECTION=<Id>" value="BM0LCPLB:1-1-6-36 " type=text name=quickSearch_searchFieldId_> <INPUT type=hidden name=EventSource> <INPUT type=hidden name=stack> <INPUT type=hidden name=currentPosition> <INPUT value=81BF3F3055F23467DA83BE94A943C651.nwanalyser-nac-cp-jboss-slave-1 type=hidden name=JSESSIONID> </TD></TR></TBODY></TABLE></FORM> The blow code does not work for me. There is no button for this form. From what I understand "onkeydown="if (event.keyCode == 13)" is the enter button. Does anyone know how I could gracefully send 'enter' to this without Winactivate or some such? $na = _IEAttach("myurl.html", "url") Local $oForm = _IEFormGetObjByName($na, "menuForm") Local $oText = _IEFormElementGetObjByName($oForm, "quickSearch_searchFieldId_") _IEFormElementSetValue($oText, "Somedata") _IEAction($oForm, "$oForm")
  7. Please ignore - my error. The code above is working fine!!
  8. Hi, I am trying find the position of: spview-directory-number-input class=" x-form-field x-form-text" tabIndex=0 value= within $sText. It is in there however StringInStr is returning 0. The string im looking for already has quotation marks in there so im assuming im doing somthing wrong with parentheses....can someone correct me please? Local $iPosition = StringInStr($sText, 'spview-directory-number-input class=" x-form-field x-form-text" tabIndex=0 value=' , 0, 1) MsgBox($MB_SYSTEMMODAL, "", "The search string first appears at position: " & $iPosition)
  9. Hi, Attached is a picture of DebugBar. I am trying to retreave the text from the Inputbox highlighted in the picture. I am getting _IEStatus_NoMatch with the following code. Its from the "$oTable = _IETagnameGetCollection($oDiv, "directoryNumber", 0) ; get first table" line. Can somone please advise on how I can retrieve text from "INPUT type=text name=directorynumber" box? #include <IE.au3> #include <MsgBoxConstants.au3> $oIE = _IEAttach("My test explorer window", "windowtitle") If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "test") ;~ Local $oIE = _IECreate("https://crt.isp.sky.com/login.php") EndIf $oDiv = _IEGetObjById($oIE, "x-auto-178") $oTable = _IETagnameGetCollection($oDiv, "directoryNumber", 0) ; get first table ;~ $oTR = _IETagnameGetCollection($oTable, "tr", 0) ; get first TR ;~ $oTD = _IETagnameGetCollection($oTR, "td", 0) ; get first TD ClipPut($oDiv.innertext) _IEAction($oDiv, "click") _IEAction($oDiv, "copy") Kind Regards Dave test2.bmp
  10. Hi jdelaney, Thanks for the reply. The script still hangs when all windows are closed...even if it didn't surley there must still be a more effective or clean way to continue interacting with the new window within the same script?
  11. Hi, I am having trouble using _IELinkClickByIndex. In my code below, near the end, when I use _IELinkClickByIndex it clicks the link I need which creates a pop-up however the script just hangs, it seems to just get stuck or be looping when I use it. Can anyone see whats wrong with my code? Func Navigate() _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended For $oLink In $oLinks If StringInStr($oLink.href, "loadFaultTracker.do") Then _IEAction($oLink, "click") ExitLoop EndIf Next _IELoadWait($oIE) Local $sMyString = "Launch application" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf Next _IELoadWait($oIE) Sleep(2000) Local $oFrames = _IEFrameGetCollection($oIE) Local $iNumFrames = @extended Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF Local $oFrame = 0 For $i = 0 To ($iNumFrames - 1) $oFrame = _IEFrameGetCollection($oIE, $i) ;~ MsgBox(0, "", $oFrame.id) $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF $o_form = _IEFormGetObjByName($oFrame, "MainForm") $oQuery = _IEFormElementGetObjByName($o_form, "faultrec_type_single") _IEFormElementSetValue($oQuery, "LLU") Sleep(500) $oQuery = _IEFormElementGetObjByName($o_form, "fault_id") _IEFormElementSetValue($oQuery, "1-25084694984") Sleep(500) $oQuery = _IEFormElementGetObjByName($o_form, "btnApplyFilter") _IEAction($oQuery, "click") Sleep(3000) ;~ _IELinkClickByIndex($o_form, 203) Next ;~ MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt) Local $oFrames = _IEFrameGetCollection($oIE) Local $iNumFrames = @extended Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF Local $oFrame = 0 For $i = 0 To ($iNumFrames - 1) $oFrame = _IEFrameGetCollection($oIE, $i) $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF $o_form = _IEFormGetObjByName($oFrame, "MainForm") ;~ _IELinkClickByIndex($o_form, 203) ExitLoop Next _IELinkClickByIndex($o_form, 203) Global $sText = _IEBodyReadText($oIE) ;~ MsgBox($MB_SYSTEMMODAL, "Body Text", $sText) ;~ ClipPut($sText) ;~ _IEQuit($oIE) EndFunc
  12. Appreciate your help guys. I still having problems tho. When I use $oFrame = _IEFrameGetObjByName($oIE, "frame1") I get the following --> IE.au3 T3.0-1 Warning from function _IEFrameGetObjByName, $_IEStatus_NoMatch (No frames matching name) I tried to use _IEFrameGetCollection with the example from the Autoit help file and it does display the text from the frame I need to fill in however im not sure how I can get the frame obj name. The frame seems to be a different URL as well....not sure if that is relavant.... Any additional ideas?
  13. Not sure how I check for sure but if I look at the DOM section then HTML in Debugbar there is an IFRAME, if I hove mouse over the word IFRAME it highlights the section of the page which I need to interact with.... <IFRAME id=frame1 onload=autoResize(); height=191 src= Is that what you mean? Also I think its Javascript, does that matter?
  14. Hi Danp2 When I run the script it logs into the site fine, it navigates through a couple of pages which is fine but then there is a page which has a form which I want the script to fill in but I cannot access the form. Using Debugbar I found the form name to be "MainForm" and the inputbox element (INPUT type=text name=fault_id_single) So I tried: Local $oForm = _IEFormGetObjByName($oIE, "MainForm") Local $oText = _IEFormElementGetObjByName($oForm, "fault_id_single") _IEFormElementSetValue($oText, "Test") Inputbox does not fill in....I missing something obvious im sure!
  15. Would it help if I provided the Debubar output?
  16. Hi, I am having trouble connecting to a web page form. The inputbox I need to connect to cannot be found. all I can find on the page is this: > input.hidden start > input.hidden hitsOnPage > input.hidden globalSearchActive > input.hidden sortType > input.text query ---- FORM 0 -------------------- > input.checkbox necessaryPerformance > input.checkbox functional > input.checkbox sharingTargeting > input.submit 0 I think I have found the Form I need to connect to with Debugbar but to be honest im I have a lot to learn about IE and how it all works. My code is below. Can anyone help? #include <GUIConstantsEx.au3> #include <Array.au3> #include <GuiButton.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <IE.au3> createIE() Func createIE() Global $oIE = _IECreate("https://www.openreach.co.uk/orpg/home/newlogin.do?smauthreason=0&target=http%3A%2F%2Fwww.openreach.co.uk%2Forpg%2Fcustomerzone%2Fappointmentservices%2FloadGetAppointment.do&fromMasterHead=1") Local $oForm = _IEFormGetObjByName($oIE, "Login") Local $oText = _IEFormElementGetObjByName($oForm, "USER") _IEFormElementSetValue($oText, "***********") Local $oText = _IEFormElementGetObjByName($oForm, "PASSWORD") _IEFormElementSetValue($oText, "************") _IEFormSubmit($oForm) _IELoadWait($oIE) Local $sTexterror = _IEBodyReadText($oIE) Local $passworderror = StringInStr($sTexterror, "password has not been recognised") If $passworderror = 0 Then Navigate() Else MsgBox($MB_SYSTEMMODAL, "Login Failed", "Attempt again manually") EndIf EndFunc Func Navigate() _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended For $oLink In $oLinks If StringInStr($oLink.href, "loadFaultTracker.do") Then _IEAction($oLink, "click") ExitLoop EndIf Next _IELoadWait($oIE) Local $sMyString = "Launch application" Local $oLinks = _IELinkGetCollection($oIE) For $oLink In $oLinks Local $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then MsgBox(0, "Form Info", "found your link") _IEAction($oLink, "click") ExitLoop EndIf Next _IELoadWait($oIE) Sleep(5000) ;~ ----------------------------------------------------------- Attempt to find form---------------------------------------------- $colForms = _IEFormGetCollection($oIE) ; get all forms For $oForm In $colForms ; loop over form collection ConsoleWrite("---- FORM " & $oForm.name & " --------------------" & @CRLF) $oFormElements = _IEFormElementGetCollection($oForm) ; get all elements For $oFormElement In $oFormElements ; loop over element collection If StringLower($oFormElement.tagName) == 'input' Then ; it is an input ConsoleWrite("> input." & $oFormElement.type & " " & $oFormElement.name & @CRLF) _IEFormElementSetValue($oFormElement, "Found You", 0) ; set value of the field ElseIf StringLower($oFormElement.tagName) == 'textarea' Then ; it is a textarea ConsoleWrite("> textarea " & $oFormElement.name & @CRLF) _IEFormElementSetValue($oFormElement, "Found You", 0) ; set value of the field EndIf Next Next ;~ -------------------------------------------------------------------------------------------------------------------------------- EndFunc
×
×
  • Create New...