dufran3 Posted July 31, 2007 Share Posted July 31, 2007 (edited) I am trying to get the search input information, so that I can input text and submit the search via a script...I believe this is the prudent code, and this is what I am trying to do. Nothing happens, no errors, and it doesn't type anything into the search input. I have tried using IE Builder, but I cannot figure out how to input text into that search field...I have done this on other websites...but this isn't working right...maybe you can look at the source snippet and see. The first snippet is what IE Builder gave me under the "form elements". 2nd code is some actual HTML source snippets. 3rd is my script trying to interact with it. IE-Builder v2.0.0 Object Type Object Count DispHTMLFormElement 4 Elements for form 0 Index Tag Name Id Extra Information Object Type 0 INPUT q Form Input Type: text Value: Search DispHTMLInputElement 1 SELECT Category DispHTMLSelectElement 2 SELECT searchFP DispHTMLSelectElement 3 INPUT Form Input Type: submit Value: Search DispHTMLInputElement HTML Source snippet <form class="searchForm" method="get" action="/search/query/p/"> <div> [<a href="http://&#()#.com/SearchHelp" onclick="openwin(href); return false;">help me with search</a>] <label accesskey="S">Search</label> <select name="searchFP" tabindex="3"> <option value="p" selected="selected">Posts</option> <option value="f" >Files</option> <!--<option value="n" >NFOs</option> --> </select> <input type="submit" value="Search" tabindex="4" /> </div> </form> </div> <!-- }}} --> <div id="Main"> not going to post the whole script, just the part that isn't working, the entering text into search input and clicking search ;Search $oSearchInput = _IEGetObjByName($oIE, 'SearchFP') _IEFormElementSetValue($oSearchInput , 'SEARCH I SAY') Edit: Removed other form elements returned by IE-Builder, only need form 0 Edited July 31, 2007 by dufran3 Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 Another little snippet.... <label accesskey="S">Search</label> <input type="text" value="Search…" onfocus="if (value=='Search…') value='';" onblur="if(value=='') value='Search…';" size="25" name="q" tabindex="1" /> See, the name says "q" so I tried to use that but didn't work.... Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 Is there a way to get it by class??? because apparently the class=searchForm...but can't interact with it... Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 I know Dale or Valuater can pwn me on this one...:-( Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 Were you able to obtain the Form object? Once that's done, you should be able to access "SearchFP" using _IEFormElementGetObjByName. Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 Were you able to obtain the Form object?I'm not sure how to obtain the form object? _IEFormGetCollection?? tried that, but not sure if it is returning anything, or how to use that function... Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 Yes, you would use _IEFormGetCollection. Example: $oForm = _IEFormGetCollection ($oIE, 0) ;This would grab the first form $oSearchInput = _IEFormElementGetObjByName($oForm, 'SearchFP') _IEFormElementSetValue($oSearchInput , 'SEARCH I SAY') Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 When using this: $oForm = _IEFormGetCollection ($oIE, 0) ;This would grab the first form $oSearchInput = _IEFormElementGetObjByName($oForm, 'SearchFP') _IEFormElementSetValue($oSearchInput , 'SEARCH I SAY')oÝ÷ Ú¶)ඬzºè«¢+Ø´´ØÈì%¹ÔÌ]ɹ¥¹É½´Õ¹Ñ¥½¸}%½ÉµÑ ½±±Ñ¥½¸°ÀÌØí}%MÑÑÕÍ}9½5Ñ (´´ØÈì%¹ÔÌÉɽÈɽ´Õ¹Ñ¥½¸}%½Éµ±µ¹ÑÑ=© å9µ°ÀÌØí}%MÑÑÕÍ}%¹Ù±¥ÑQåÁ(´´ØÈì%¹ÔÌÉɽÈɽ´Õ¹Ñ¥½¸}%½Éµ±µ¹ÑMÑY±Õ°ÀÌØí}%MÑÑÕÍ}%¹Ù±¥ÑQåÁ(Ðíá¥Ð½èÀQ¥µèÄĸÄØØ Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 How about $oForms = _IEFormGetCollection ($oIE) MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page") If this source code is present:CODE<form class="searchForm" method="get" action="/search/query/p/"> <div> [<a href="http://&#()#.com/SearchHelp" onclick="openwin(href); return false;">help me with search</a>] <label accesskey="S">Search</label> <select name="searchFP" tabindex="3"> <option value="p" selected="selected">Posts</option> <option value="f" >Files</option> <!--<option value="n" >NFOs</option> --> </select> <input type="submit" value="Search" tabindex="4" /> </div> </form> Then, _IEFormGetCollection should find something. Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 Msgbox says there are 0 forms on the page... Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 it could be a problem with IE7 as _IECreate opens up 2 IE windows.... Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 When using this code #include<IE.au3> $oIE = _IECreate() _IENavigate($oIE,'www.google.com')oÝ÷ Ùh^îØb³;Ú)z{.¥¦åjy0whÂØ^^Ë©jw°Â)Ý£ Ú¾(µçm¢ØZµ§]ë,I©Â+a¶¬r^jëh×6#include<IE.au3> $oIE = _IECreate('www.google.com') Link to comment Share on other sites More sharing options...
GMK Posted July 31, 2007 Share Posted July 31, 2007 (edited) If you already have an IE window open while running the _IECreate function, have you tried attaching? _IECreate("www.google.com", 1) Maybe you need to brush up on the IE.au3 help files? Edit: There aren't any frames, are there? Edited July 31, 2007 by GMK Link to comment Share on other sites More sharing options...
AzKay Posted July 31, 2007 Share Posted July 31, 2007 Whats the URL for the page? # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 (edited) www.newzbin.com i'm just trying to use the search feature... Edited July 31, 2007 by dufran3 Link to comment Share on other sites More sharing options...
AzKay Posted July 31, 2007 Share Posted July 31, 2007 Could try, $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oQuery = "LULZ I R GUD SERCHER" $oHTTP.Open("GET", "http://www.newzbin.com/search/query/p/?q=" & $oQuery & "&Category=-1&searchFP=p") $oHTTP.Send() ConsoleWrite($oHTTP.ResponseText & @CRLF) But then again, Httprequests are my answers to everything. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
dufran3 Posted July 31, 2007 Author Share Posted July 31, 2007 I don't think an http request is going to work for this. thanks though! Link to comment Share on other sites More sharing options...
AzKay Posted July 31, 2007 Share Posted July 31, 2007 Well, It works for me. # MY LOVE FOR YOU... IS LIKE A TRUCK- # Link to comment Share on other sites More sharing options...
Will66 Posted July 31, 2007 Share Posted July 31, 2007 searchFP is a select box so you can only set its "selected" value.p is the input text box which you need to set your search value.Without knowing how your program flows you could cut out the middleman altogether and build your search query into the url string rather than manipulate the form and navigate directly to the results page:$q="test"$Category =-1$searchFP="p"$searchstring ="http://www.newzbin.com/search/query/p/?q=" & $q & "&Category=" & $Category & "&searchFP=" & $searchFPbuildshttp://www.newzbin.com/search/query/p/?q=t...&searchFP=p Link to comment Share on other sites More sharing options...
AzKay Posted August 1, 2007 Share Posted August 1, 2007 That too. xD # MY LOVE FOR YOU... IS LIKE A TRUCK- # 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