Search the Community
Showing results for tags '_IEFormElementSetValue'.
-
I am trying to create an autologin script for a website we use at work. Although the website is public, I obfuscated the $url deliberately, so it won't show up in public web searchs. Also username and password are not the working one 😁 #include <IE.au3> ;$url is delibered obfuscated so it wont be indexed by searchrobots!!! $url = "https://o" & "rdermanager." & "teca" & "llianc" & "e.net/new" & "app/" & "auth/login" $oIE = _IECreate ($url,0,1,1) $HWND = _IEPropertyGet($oIE, "hwnd") WinActivate ($HWND,"") WinSetState($HWND, "", @SW_MAXIMIZE) $oUsername = _IEGetObjById ($oIE,"login-txt-username") $oPassword = _IEGetObjById ($oIE,"login-txt-password") $oButton = _IEGetObjById ($oIE,"changepwd-btn-request") _IEFormElementSetValue ($oUsername, "me@test.com") _IEFormElementSetValue ($oPassword, "Test1234!") _IEAction ($oButton, "click") When running the above code, the fields are populated, however when [Login] button is "clicked" the fields wil show "This field is required". Only when I add a charachter manually and remove that character for each field, the page will update the values internally. Could some tell me a way to fix this? The cookie button on the top of the page does not have an ID, so I do not how to click on it from autoit. Is there another way to press this button ?
-
Hi, Google changed the style of translation page therefore _IEFormElementSetValue stopped working to set values in the google translator page automatically, I tried my best to fix it but it's not happening. It was working perfect a month ago almost before launching of new google translation interface. Any help would be highly appreciated... I'm using a kind of function that help to set values in the form to google translator page and let it translate and then retrieve it back to save in a text file. Here is my code: #RequireAdmin #include <IE.au3> #include <String.au3> #include <Array.au3> #include <Excel.au3> #include <File.au3> ;*****************************Splitting Source Code Ended***************************** Local $oExcel = _Excel_Open() Local $oWorkbook1 = _Excel_BookOpen($oExcel, @ScriptDir & "\example.xlsx", False) ;*****************************Saving Software Links Started*************************** ;*****************************Splitting Source Code Started***************************** ;***************************************** Saving Title + .rar link + Description text file No. 1***************************** ProcessClose ( "iexplore.exe") $file = fileopen(@ScriptDir & "\source.txt", 10) $splitting = _Excel_RangeRead ($oWorkbook1, Default, "A1") $IE = _IECreate($splitting, 0, 0) $source = _IEDocReadHTML($IE) FileWrite($file, $source) $target_source5 = _StringBetween($source, '</h1>', '<i>Скачать</i>') If Not @error Then FileWrite (@ScriptDir & "\kat01.txt", $target_source5[0]) Sleep (50) ; removing of HTML codes to convert data into simple text $File1 = @ScriptDir & "\kat01.txt" $txt = FileRead($File1) $txt = StringReplace($txt, "<br>", @crlf) $txt = StringRegExpReplace($txt, '(?s)<a.*?</a>|<.*?>', "") $txt = StringStripWS ( $txt, $STR_STRIPSPACES) $txt = StringReplace($txt, "<br><", "") $txt = StringReplace($txt, "--", "") $txt = StringReplace($txt, "---", "") $txt = StringReplace($txt, " ", " ") $txt = StringReplace($txt, "_", "") $txt = StringReplace($txt, " ", "") FileWrite (@scriptdir & '\kat_saved.txt', $txt) Local $sFilePath = @ScriptDir & "\kat_saved.txt" ProcessClose ( "iexplore.exe") Example1() EndIf ;********************Example1 Function Written Started***************************** Func Example1() $Text = FileRead ($sFilePath) Local $aArray = StringSplit($Text, @CR) For $i = 1 To $aArray[0] Local $tag="* *" Local $oIE=_IECreate("https://translate.google.com/#ru/en", 1, 1) $HWND = _IEPropertyGet($oIE, "hwnd") WinSetState($HWND, "", @SW_MAXIMIZE) Sleep (500) Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & $aArray[$i] & @CR & $tag) MouseMove ( 930, 275, 10) MouseClick ( "Main", 930, 275, 5, 10) Sleep(1000) MouseMove ( 930, 200, 10) MouseClick ( "Main", 930, 200, 5, 10) Sleep (10000) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) _IEQuit($oIE) ProcessClose ( "iexplore.exe") Sleep (1000) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines[0]) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines[0]=UBound($lines)-1 $FilePath = @ScriptDir & "\Translated.txt" $arraytostring = _ArrayToString ($lines) $txt = StringReplace($arraytostring, "1|", "") $txt = StringReplace($txt, "|", "") FileWrite ($FilePath, $txt & @CRLF) Next EndFunc ;MsgBox ('', 'Done Bro', 'Done Bro')
-
- _ieformelementsetvalue
- google translation
-
(and 2 more)
Tagged with:
-
Hello! I'm new to the forums! Couldn't find any threads covering this issue. Sorry if I'm wrong. I'm having problems changing the text/value of a input box. The particular box doesn't have a name or id, just: class="jq_hotkeys_enabled form-control". This class appears multiple times throughout the source, so I don't think It's right to reference that object. See image 1. However, I've managed to find a object with the name "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper" which contains the value of the input box, and the id for the person in the dropdown/combobox left of it. (with "dummy-1" selected). See image 2. As you can see the value is 3982,4545 ( name , time ) But when I try to change the value of it by doing: #include <IE.au3> Local $oIE = _IEAttach(WinGetHandle("[CLASS:IEFrame]"),"embedded") Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oInput = _IEFormElementGetObjByName($oForm, "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper") _IEFormElementSetValue($oInput, "3982,1337") The box doesn't get its new value. I can see in the source that it's changed though. See image 3. However, if I do: #include <IE.au3> Local $oIE = _IEAttach(WinGetHandle("[CLASS:IEFrame]"),"embedded") Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oInput = _IEFormElementGetObjByName($oForm, "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper") _IEFormElementSetValue($oInput, "3982,1337") $oIE.document.parentwindow.execScript("theForm.submit()") ; But it needs to reload the page The box gets its new value after the page reloads by the theForm.submit() function. This is a bit unfortunate as I want the changes to happen instantly like when I type in the box with the keyboard... or select in the combobox. Maybe someone knows how I can do this? Looking forward to an answer! Thanks in advance. Note: Unfortunately I can't provide with the real URL as it is constricted to employees in the company I work for, but let me know If I should provide anything else.
- 19 replies
-
- ie
- _ieformelementsetvalue
-
(and 3 more)
Tagged with:
-
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)
- 1 reply
-
- _IETagNameGetCollection
- IE
-
(and 2 more)
Tagged with:
-
I'm trying to adapt the example #include <IE.au3> Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oText = _IEFormElementGetObjByName($oForm, "textExample") _IEFormElementSetValue($oText, "Hey! This works!") to work with a log in page and I'm not sure what I'm doing wrong and why its acting up. This is what I tried: #include <IE.au3> Local $oIE = _IEAttach("C:\Test.html","Windowtitle") Local $oForm = _IEFormGetObjByName($oIE, "form_auth") Local $oText = _IEFormElementGetObjByName($oForm, "usuario") _IEFormElementSetValue($oText, "Hey! This works!") but it doesn't fill out the form. Here is a snippet of the HTML of the form I'm working with: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> <body> <div class="opLogonBody"> <div class="left"> <div class="opLogonComponent"> <div id="auth" class="security"> <form id="form_auth" action="BtoChannelDriver.ssobto?dse_contextRoot=true" method="post" > <div class="body"> <div class="superior"> <fieldset class="identificacion" id="identificacion"><legend>Data</legend> <p>Please enter your logon information and press "Send"</p> <div class="row"><label for="id_1">User:</label><input name="usuario" type="text" id="id_1" maxlength="50" onfocus="idToWrite=	id_1	;pos=null" /></div> <div class="row"><label for="clave">Password:</label><input type="password" name="password" id="clave" maxlength="30" onfocus="idToWrite=	clave	;pos=null"/></div> </fieldset> </div> </div> <div class="foot"><span class="buttons"><input type="submit" value="Send"/></span><span class="link"><a href="" id="id_authenticateLink"></a></span></div> </form> </div> </div> </div> </div> </body> </html> Anyone know why it is not filling out the form?
-
Hi Folks. Looking for a little assistance to help login to one of my company's application's web pages. These are Intranet based pages, and not open to the general public, and I will try to provide the code and screen shots where I can. I have been attempting to get this login script to work for quite some time. Any help would be appreciated. I have 3 types of issues here. 1. using the basic _IEFormElementSetValue, instead of replacing the grayed out verbiage (user name) with an un-grayed out text (actual user name in black type font), it does enter the user name, but it is entered still as grayed out text in the input box. 2. to get the above to work, i've replaced using _IEFormElementSetValue and instead use an "_IEAction" (2 actually - focus / select all) then a "send" to manually put in the username. This works upon initial launch of the page, but when logged out, and logging back in, the IEactiion and send fail to enter the fields. 3. My company has an .hta application that launches a reporting app, but the page is designed exactly the same as the web page, (except the app contains the code - the .hta app), but it is still the exact same fields defined. Theoretically knowing the input boxes names as I do and that they're the same, I should be able to log into this app the same way. However, I can not. I once contacted dale through email to question why the .hta app would not respond, and he gave me some ideas, and stated if I still have issues, to post a topic here. so this is what I'm doing, because I still have issues with the .hta app. And I've also tried to attach to the .hta application as an embedded application, but still could not get the fields to populate (log in screen). I have attached screen shots of the intial view of the sign on page, and the view of an attempted signon using _IEFormElementSetValue. Here is my code to attempt to attach / launch-create the web page. Func _LaunchAdminApp () If $CurServNam= "" Then Return If WinExists("PCDS :: Management") Then Return Local $FTMAddress= "https://"&$CurServNam&"/admin" If NOT WinExists("Fluency for Imaging Log On") Then Local $oIE = _IECreate($FTMAddress) Else Local $oIEWhnd = WinGetHandle("Fluency for Imaging Log On") Local $oIE = _IEAttach($oIEWhnd) EndIf Local $Count = 0 If $AdmAutoLogin = 1 Then If $LoginIDAA = "" Then Return Do $Count+=1 Sleep(100) If $Count > 30 Then MsgBox(0,"Sorry","Can't sign in to Admin App!") Return EndIf Until IsObj($oIE) Local $oForm = _IEFormGetCollection($oIE,0) $Count = 0 Do $Count+=1 Sleep(100) If $Count > 30 Then MsgBox(0,"Sorry","Can't sign in to Admin App!")5 Return EndIf Until IsObj($oForm) WinActivate($oIE) Local $oQueryUser= _IEFormElementGetObjByName ($oForm, "UserName" ) Local $oQueryPW = _IEFormElementGetObjByName ($oForm, "PasswordDisplay") Local $CompID = _IEFormElementGetObjByName ($oForm, "Domain" ) Local $oSubmit = _IEFormElementGetObjByName ($oForm, "loginBtn" ) Sleep(500) ;_IEAction ($oQueryUser,"focus" ) ;_IEAction ($oQueryUser,"selectall" ) ; Send ($LoginIDAA );this will work only for initial login, not for subsequent log in's after logoff. _IEFormElementSetValue ($oQueryUser, $LoginIDAA );this does not work. enters name in gray text, app does not think its there, but can see it. ;_IEAction ($oQueryPW, "focus" ) ;_IEAction ($oQueryPW, "selectall" ) ; Send ($PasswordAA );this will work only for initial login, not for subsequent log in's after logoff. _IEFormElementSetValue ($oQueryPW, $PasswordAA );this does not work. enters password in gray text, app does not think its there, but can see it. _IEFormElementOptionSelect ($CompID,0,1,"byIndex" ) Sleep(5000) If IsObj($oSubmit) Then $oSubmit.click() EndIf If $CloseAfSelAA = 1 Then Exit EndFunc Basically, i'm checking to see if the pages exists first, then either creating a page or attaching to a page depending upon the results of the check. I've also attached the source for the signon page for the web app. Note that the code delivered via the .hta for sign on is exactly the same. any and all suggestions are most welcome. I'm at my witts end here! Thanks in advance! (I love AutoIT! and this site!) view of signon screens.zip Company Application Signon Page.html
- 2 replies
-
- Internet Explorer 9
- windows 7
-
(and 1 more)
Tagged with:
-
I'm trying to make an auto-login script for betfair.com. In the code below I've read and printed out the id of each form element - this helped me find the username and password fields. #include<IE.au3> $oIE = _IECreate("http://www.betfair.com/exchange") $oForms = _IEFormGetCollection($oIE) $formcount = 0; For $oForm In $oForms $formcount = $formcount+1 $newID = $oForm.id ConsoleWrite(@CRLF & 'formcount = ' & $formcount & @CRLF) ConsoleWrite('New ID = ' & $newID & @CRLF) If $formcount = 2 Then ; login form is the 2nd form on the webpage Local $oQuery = _IEFormElementGetCollection($oForm, -1) $elementcount = 0 For $oQuery2 In $oQuery ; read through the ogin form ; print details of each element of form $elementcount = $elementcount + 1 ConsoleWrite('$elementcount = ' & $elementcount & @CRLF) $a = _IEFormElementGetValue( $oQuery2 ) ConsoleWrite('$a = ' & $a & @CRLF) If $elementcount = 4 Then ; username field _IEFormElementSetValue( $oQuery2 ,"MYUSER") EndIf If $elementcount = 6 Then ; password field _IEFormElementSetValue( $oQuery2 ,"MYPASS") EndIf Next EndIf Next However, after the script has run, if I click on the "password" field in the webpage, the string "MYPASS" disappears. Does this mean I didn't set the form element value correctly? The html code for the form is a bit complex, perhaps someone can see something in it that I don't understand well enough to spot.