Jump to content

Facebook makes me crazy..


Recommended Posts

I can't keep asking questions about Facebook i know :blink:

But it makes me crazy. I really want to finish my project.

So in part of my code, i want to enter a search string to Facebook's search box (seems very easy.)

I used this code;

$oIE = _IECreate("https://facebook.com/") ;logged in previously. So automatically redirect to the home page...
_IELoadWait($oIE)
Sleep(3000)
$oSearchForm2 = _IEFormGetCollection($oIE,"navSearch")
Sleep(3000)
$oSearchBox2 = _IEFormElementGetObjByName($osearchform2,"q")
$sstring2 = 'TESTTESTESTESTESTESTEST'
Sleep(3000)
_IEFormElementSetValue($oSearchBox2,$sstring2)
Sleep(1000)
$submit = _IEGetObjByName($oIE,"",10)
_IEAction($submit,"click")

I'm not sure about submit button. but it's my second problem. This code can't enter sstring2 to the searchbox2.

I couldn't see the problem. And i know it's my problem. Something must be very easy. But i can't get it.!!!

Edited by continyu
Link to comment
Share on other sites

You are using the wrong syntax for both _IEFormGetCollection (I think you want _IEFormGetObjByName) and _IEGetObjByName. Please check the helpfile and examples. Also, watch the SciTe console for warnings and errors from IE.au3 - they are important.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

You are using the wrong syntax for both _IEFormGetCollection (I think you want _IEFormGetObjByName) and _IEGetObjByName. Please check the helpfile and examples. Also, watch the SciTe console for warnings and errors from IE.au3 - they are important.

Dale

Thanks for your answers :blink:

In fact i can be wrong about those funcs. but i'm trying to select some form and form elements which don't have NAME...

Link to comment
Share on other sites

Hmm

Try to save page as HTML on hard disk, and then search what do you need

Maybe not professional help, but always better than nothing :blink:

Edit: Ofc search the string like from .txt file =)

Edited by Sobiech

This world is crazy

Link to comment
Share on other sites

@Sobiech - saving the html to a file does not capture any dynamic html on the page, which is why I recommend something like DebugBar to analyze the html code

@continyu - if you read the Remarks section in the helpfile for the _IEForm*GetObjByName functions, you'll see a note about elements without names that points you to the _IEForm*GetCollection functions... there you find examples of what to do

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...