Jump to content
Sign in to follow this  
boshi

Detect Form Element Inside Facebook Iframe

Recommended Posts

boshi

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
Melba23

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  

  • Similar Content

    • SkysLastChance
      By SkysLastChance
      I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 
      The id and name change all the time so I can't use those. 
      The code highlighted in blue is what I am trying to click. (second picture)
      Here is what I have tried.
      $target = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "s_92 altstyle s_93 s_94" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText&@CRLF) ExitLoop EndIf Next  

       
       

    • AnonymousX
      By AnonymousX
      Hello, 
      I'm trying to write a script that can go to a specific work related webpage, then grab the html text out of a known recorded comment field. I have a basic understanding of HTML, but I'm confused by the website as when I open up source code I get something called frames/iframes. Not sure what that really is.... 
      Anyways using chrome and opening up source code it made a little more sense, and could trace all content I want falls within what I see as "top/mainFrame (retrieve.do)/notesActionHistoryHistory (iframeComments.jsp)/bcwebapp:8500/oinc"
       
      Is there an easy way to make a variable contain all the html text within this frame?
       
       
      Background:
      Website is on companies intranet, and each project has it's own page. I need a way to go through an excel list of projects, open up the webpage to the respective projects, then grab all the comments for those projects, then paste everything into 1 text file. My idea is to copy the excel list into an array, then use it to go one by one to the different webpages and copy the comments into an array, then paste it all into a text file. I've pretty much got all the pieces figured out, except how to grab the actual html comment data. I can do it manually but who wants to do that...
       
      Thanks for any help in advance
    • 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.

×