Sign in to follow this  
Followers 0
boshi

Detect Form Element Inside Facebook Iframe

2 posts in this topic

#1 ·  Posted (edited)

Hello Autoit fella..

I made a script to fill in form but the problem is, the script cannot detect the text area because it is inside the Facebook Iframe [as the screenshot attached]

Posted Image

the url usually like this: https://www.facebook.com/thefanpagename?sk=app_163706647070644

meaning it is an apps inside facebook. the source code of the form as below:

<div id="header_promotion" class="ss_box_header ss_promotion_header">
  <h3>Promotion</h3>
</div>

<div id="content_promotion" class="ss_box_content ss_promotion_content">
      
<div id="header_msg_promotion" class="ss_promotion_header_msg"></div>
<form id="form_promotion" class="ss_promotion_form" method="post" action="/facebook/form/3355393" novalidate="novalidate"><div style="margin: 0px; padding: 0px; display: inline;"><input name="authenticity_token" value="ZjE2tDCq2bCItnxLf79QXqtjkaZ2YI5pgl+DrIfPtb0=" type="hidden"></div>
  <input id="simulated" name="simulated" value="137101329662830" type="hidden">
      <div id="promotion_email_block" class="field_block email_field_block">
  <label for="promotion_email"><span class="main_field_label">Emel Anda</span><span class="required">*</span></label>
  <input id="promotion_email" name="promotion[email]" type="text">
  </div>

      <div id="promotion_name_block" class="horizontal_container name_field_block">
  <label for="promotion_name"><span class="main_field_label">Nama Anda</span><span class="required">*</span></label>
  <div id="promotion_first_name_block" class="field_block first_child first_name_field_block">
    <input id="promotion_first_name" name="promotion[first_name]" type="text">
    <label class="sublabel" for="promotion_first_name">First</label>
  </div>  <div id="promotion_last_name_block" class="field_block last_name_field_block">
    <input id="promotion_last_name" name="promotion[last_name]" type="text">
    <label class="sublabel" for="promotion_last_name">Last</label>
  </div>  <div class="clear"></div>
  </div>

      <div id="promotion_phone_block" class="field_block phone_field_block">
  <label for="promotion_phone"><span class="main_field_label">Nombor HP</span><span class="required">*</span></label>
  <input id="promotion_phone" name="promotion[phone]" type="text">
  </div>

     <div id="promotion_custom_field_1_block" class="field_block custom_field_1_field_block select_field_type_block">
  <label for="promotion_custom_field_1"><span class="main_field_label">Negeri</span><span class="required">*</span></label>
  <select id="promotion_custom_field_1" size="0" name="promotion[custom_field_1]"><option value="WP Kuala Lumpur">WP Kuala Lumpur</option>
<option value="Selangor">Selangor</option>
<option value="Negeri Sembilan">Negeri Sembilan</option>
<option value="Melaka">Melaka</option>
<option value="Johor">Johor</option>
<option value="Pahang">Pahang</option>
<option value="Terengganu">Terengganu</option>
<option value="Perak">Perak</option>
<option value="Pulau Pinang">Pulau Pinang</option>
<option value="Kedah">Kedah</option>
<option value="Kelantan">Kelantan</option>
<option value="Sabah">Sabah</option>
<option value="Sarawak">Sarawak</option>
<option value="WP Labuan">WP Labuan</option></select>
  </div>


     <div id="promotion_submit_block" class="field_block submit_field_block">
     <a class="form_submit ss_btn" onclick="return SST.form_submit(widget_3355393);" href="#">Daftar</a>
   </div>

<div id="message_promotion" class="ss_promotion_message ajax_message"></div>
</form>

<a style="display: none;" id="on_success_promotion" onclick="ss_gift_popup(gift_popup, widget_3355392, null, this); return false;" href="#"></a>

  </div>
<div id="footer_promotion" class="ss_box_footer ss_promotion_footer">
  </div>

My autoit code goes like this

<snip>

Edited by Melba23
Spam code removed

Share this post


Link to post
Share on other sites



boshi,

Looks to me as if you are trying to spam a social media promotion page. Please read the Forum Rules and you will understand why this thread is now locked. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Similar Content

    • FengHuangWuShen
      By FengHuangWuShen
      So I was playing with INet and downloading files and made a simple video downloader, or it can even be used for any file really.
      Just follow the reference section in INet_Settings.ini , and then run the script.
       
      Main Script #include <INet.au3> #include <InetConstants.au3> #include <WinAPIFiles.au3> #include <Array.au3> #include <String.au3> OnAutoItExitRegister('INET_CLOSE') $GET_URL = _INetGetSource(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Request', 'Url', Default)) $STRING_START = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'Start', Default) $STRING_END = IniRead(@ScriptDir & '\Inet_Settings.ini', 'Data', 'End', Default) $GET_STRING = _StringBetween ($GET_URL, $STRING_START, $STRING_END) $VIDEO_URL = _ArrayToString($GET_STRING) $VIDEO = _URIDecode($VIDEO_URL) If StringLen($VIDEO) > 0 Then Local $VIDEO_DIR = (@ScriptDir & '\' & Random(1, 65535) & '.mp4') Local $DOWNLOAD_VIDEO = InetGet($VIDEO, $VIDEO_DIR, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(IniRead(@ScriptDir & '\Inet_Settings.ini', 'Settings', 'Delay', Default)) Until InetGetInfo($DOWNLOAD_VIDEO, $INET_DOWNLOADCOMPLETE) InetClose($DOWNLOAD_VIDEO) Else MsgBox(0, 'DEBUG', "Video doesn't exist") EndIf Func INET_CLOSE() InetClose($DOWNLOAD_VIDEO) EndFunc Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc  
      INet_Settings.ini  URL - The target URL of the video you're trying to grab Data - This is the starting string, and ending string reference to look for the download URL itself. Settings - Only setting here currently, is the delay in which to wait for the file to download ### Reference for Start and End points for various websites [Request] Url = https://www.facebook.com/lindseystirlingmusic/videos/1527732263925622/ [Data] Start = hd_src_no_ratelimit:" End = " [Settings] Delay = 250 ################################################################################################### Instagram : https://www.instagram.com/p/Video ID Or : https://www.instagram.com/p/Video ID/?taken-by=User ID Start = video:secure_url" content=" End = " Facebook : https://www.facebook.com/User ID/videos/Video ID/ Or : Right click on the video and copy URL Start = hd_src_no_ratelimit:" End = " Start = sd_src_no_ratelimit:" End = " ###################################################################################################  
      Credits to : https://www.autoitscript.com/forum/profile/31965-progandy/  for the URL Encode and Decode.
    • taylansan
      By taylansan
      Hello,
      I'm trying to set the value of an input value in an iframe which is a cross reference.
      Here is my code:
      $oFrame = _IEFrameGetObjByName($oIE, "AID_1460048722447_iframe") If @error Then ConsoleWrite("Cannot get this frame" & @CRLF) EndIf If Not IsObj($oFrame) Then ConsoleWrite("Frame was not found" & @CRLF) EndIf ;try each item one by one $o1 = _IEGetObjById($oFrame, "serviceNo_input_value") $o2 = _IEGetObjByName($oFrame, "searchCond.serviceNo") $o3 = _IEFrameGetObjByName($oFrame, "searchCond.serviceNo") $o4 = _IEFormGetObjByName($oFrame, "searchCond.serviceNo") $o5 = _IEFormElementGetObjByName($oFrame, "searchCond.serviceNo") This is the output for each $o1 to $o5 trying:
      ;result for $o1 --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop "C:\Program Files\AutoIt3\Include\IE.au3" (1899) : ==> The requested action with this object has failed.: If IsObj($oObject.document.getElementById($sID)) Then If IsObj($oObject^ ERROR ->00:08:17 AutoIt3.exe ended.rc:1 +>00:08:17 AutoIt3Wrapper Finished. ;result for $o2 "C:\Program Files\AutoIt3\Include\IE.au3" (1875) : ==> The requested action with this object has failed.: If IsObj($oObject.document.GetElementsByName($sName).item($iIndex)) Then If IsObj($oObject^ ERROR ->00:09:49 AutoIt3.exe ended.rc:1 +>00:09:49 AutoIt3Wrapper Finished. ;result for $o3 "C:\Program Files\AutoIt3\Include\IE.au3" (704) : ==> The requested action with this object has failed.: $oTemp = $oObject.document.parentWindow $oTemp = $oObject^ ERROR ->00:10:18 AutoIt3.exe ended.rc:1 +>00:10:18 AutoIt3Wrapper Finished. ;result for $o4 "C:\Program Files\AutoIt3\Include\IE.au3" (930) : ==> The requested action with this object has failed.: Local $oCol = $oObject.document.forms.item($sName) Local $oCol = $oObject^ ERROR ->00:10:33 AutoIt3.exe ended.rc:1 +>00:10:33 AutoIt3Wrapper Finished. ;result for $o5 --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop --> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType +>00:10:49 AutoIt3.exe ended.rc:0 +>00:10:49 AutoIt3Wrapper Finished. I have also checked these posts for reference, but I'm missing something which I cannot find.
      ie nested tables how to get to a nested table checking a checkbox that is inside an iframe html tag inside html tag how to select a radio button in an iframe iframe click a button cross domains I don't know how to copy the content of this html at once, so I provided in screenshot. Is there a way that I can get this element?

    • avidovi
      By avidovi
      Hello Friends,
      I need your advise automating Facebook search project.
      I need to enter a string in a search input box, the inspect element shows me this code:
      <input name="query" class="inputtext" aria-required="true" aria-label="Search" required="1" type="text" maxlength="100" placeholder="Search this group" value="" autocomplete="off"> How to treat it? as a form? as an IE object?
      Really appreciating your help.

    • akira2891
      By akira2891
      Hi, im trying to make a small facebook messenger, but normally that i have problem since im here
      How to get all friend and chat with them ? over TCP or UDP ?
      And now window is not hidden but in future will be and process too.
      Im not so good in explaining things but here is code
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIListBox.au3> #include <IE.au3> Global $window = _IECreate('https://www.facebook.com/', 0, 0, 1), $Form1, $login, $email, $password, $stayLogged Local $oWbn = _IEGetObjById($window, "pagelet_welcome_box") If IsObj($oWbn) = 0 Then ;~ MsgBox(0, '', 'not logged') $Form1 = GUICreate("Facebook messenger", 359, 210, 338, 218) GUICtrlCreateGroup("", 10, 8, 337, 137) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUICtrlCreateLabel("Email :", 64, 36, 40, 19) $email = GUICtrlCreateInput("", 107, 32, 217, 23) GUICtrlCreateLabel("Password :", 41, 73, 63, 19) $password = GUICtrlCreateInput("", 107, 70, 217, 23, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) $stayLogged = GUICtrlCreateCheckbox("Stay logged", 107, 104, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $login = GUICtrlCreateButton("Login", 10, 156, 337, 41) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") GUISetState(@SW_SHOW) Else GUIDelete($Form1) ; if already logged in show other form ;~ MsgBox(0, '', 'logged in') $Form2 = GUICreate("Facebook Chat", 448, 466, 299, 146) $friendlist = GUICtrlCreateList("", 16, 16, 417, 266) $chatwindow = GUICtrlCreateList("", 16, 296, 417, 97) $text = GUICtrlCreateInput("", 16, 392, 417, 21) $sendBtn = GUICtrlCreateButton("Send", 360, 424, 75, 25) $logout = GUICtrlCreateButton("Logout", 16, 424, 75, 25) GUISetState(@SW_SHOW) EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $login _checkLogin() Case $sendBtn _sendMsg() EndSwitch WEnd ; check login Func _checkLogin() If IsObj($oWbn) = 0 Then ; if not logged in ; check if empty fields If GUICtrlRead($email) == '' Or GUICtrlRead($password) == '' Then MsgBox(64, 'Info', 'Please enter email and password') Else #cs - opens hidden internet explorer window - opens facebook page - get ID's form, email, password, remember me, and submit button - set values from GUI - submit form #ce $formID = _IEGetObjById($window, 'login_form') $emailID = _IEGetObjById($window, 'email') $passID = _IEGetObjById($window, 'pass') $rememberID = _IEGetObjById($window, 'persist_box') $loginBtnID = _IEGetObjById($window, 'u_0_v') _IEFormElementSetValue($emailID, GUICtrlRead($email)) ; set email _IEFormElementSetValue($passID, GuictrlRead($password)) ; set password ; check for stay logged checkbox If GUICtrlRead($stayLogged) = $GUI_CHECKED Then _IEFormElementCheckBoxSelect($formID, 'persistent', '', 1, 'byIndex') Sleep(1000) EndIf _IEFormSubmit($formID) ; submit form EndIf ;=> login form EndIf ;=> if not logged in EndFunc ;=> check login ; send message Func _sendMsg() GUICtrlSetData($chatwindow, GUICtrlRead($text)) EndFunc  
    • Lukeo
      By Lukeo
      I am trying to send external commands to a flash player in an iframe. I need to get a handle on it in a browser opened by the $oIE.navigate method.
      is there a way that this can be done?