Jump to content

IE Form problem


Hapla
 Share

Recommended Posts

Hi,

look at this

<div class="content">
    <form method="post" action="http://nk.pl/poczta/compose/35008483" accept-charset="UTF-8" id="form1"><div class="attached_scripts hidden"></div><input type="hidden" name="auto_form_ticket" value="4d4b3a1ddab196eb14bcf79a"><input type="hidden" name="__utm_admin" value="ΝO"><input type="hidden" name="target" value="/poczta/compose/35008483"><input id="quick_message_hidden_uid" type="hidden" name="mail_recipient_search" value="0"><label for="quick_message_focal">Temat:</label><input id="quick_message_focal" name="topic" type="text" value=""><label for="quick_message_body">Treść wiadomości:</label><textarea id="quick_message_body" name="content" rows="5" cols="40"></textarea><div id="quick_message_accept_regulations"><input id="form1_accept_regulations" name="accept_regulations" type="checkbox" value="1"><label for="form1_accept_regulations">Akceptuję <a href="/profile/regulamin">regulamin</a></label></div><a href="#nogo" id="send_with_gift" onclick="return online_list.send_present_with_text();" class="wyslij"><img alt="Wyślij wiadomość z prezentem" src="http://1.s-nk.pl/img/friends/button_wyslijprezent" /></a><button id="quick_message_submit" class="type_3" type="submit"><table><tr><td class="btn_l"></td><td class="btn_m">Wyślij</td><td class="btn_r"></td></tr></table></button><div class="clear"></div></form>  </div>
  <div id="quick_message_bottom">
  </div>

I want to set value in "Temat:" with id of "quick_message_focal" or name "topic"

Here is my code

#include <IE.au3>
$oIE = _IECreate("http://nk.pl/poczta/compose/35008483")
$oForm = _IEFormGetObjByName ($oIE, "form1")
$oQuery = _IEFormElementGetObjByName ($oForm, "topic"); i tried topic and quick_message_focal
_IEFormElementSetValue ($oQuery, "example")

It's doesn't work I don't know why, help me please

Link to comment
Share on other sites

What messages are displayed to the SciTe console when you run this? Please pay attention to them.

BTW, here is your HTML in readable form... please do this work for us next time:

<div class="content">
<form method="post" action="http://nk.pl/poczta/compose/35008483" accept-charset="UTF-8" id="form1">
<div class="attached_scripts hidden"></div>
<input type="hidden" name="auto_form_ticket" value="4d4b3a1ddab196eb14bcf79a">
<input type="hidden" name="__utm_admin" value="?O">
<input type="hidden" name="target" value="/poczta/compose/35008483">
<input id="quick_message_hidden_uid" type="hidden" name="mail_recipient_search" value="0">
<label for="quick_message_focal">Temat:</label>
<input id="quick_message_focal" name="topic" type="text" value="">
<label for="quick_message_body">Tresc wiadomosci:</label>
<textarea id="quick_message_body" name="content" rows="5" cols="40"></textarea>
<div id="quick_message_accept_regulations">
<input id="form1_accept_regulations" name="accept_regulations" type="checkbox" value="1">
<label for="form1_accept_regulations">Akceptuje <a href="/profile/regulamin">regulamin</a></label></div>
<a href="#nogo" id="send_with_gift" onclick="return online_list.send_present_with_text();" class="wyslij">
<img alt="Wyslij wiadomosc z prezentem" src="http://1.s-nk.pl/img/friends/button_wyslijprezent" /></a>
<button id="quick_message_submit" class="type_3" type="submit"><table><tr><td class="btn_l"></td>
<td class="btn_m">Wyslij</td>
<td class="btn_r"></td></tr></table></button>
<div class="clear"></div></form>
</div>
<div id="quick_message_bottom"></div>

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

I used your code and HTML and this example works:

#include <IE.au3>

$oIE = _IECreate()

$s = ''
$s &= '<div class="content">'
$s &= '<form method="post" action="http://nk.pl/poczta/compose/35008483" accept-charset="UTF-8" id="form1">'
$s &= '<div class="attached_scripts hidden"></div>'
$s &= '<input type="hidden" name="auto_form_ticket" value="4d4b3a1ddab196eb14bcf79a">'
$s &= '<input type="hidden" name="__utm_admin" value="?O">'
$s &= '<input type="hidden" name="target" value="/poczta/compose/35008483">'
$s &= '<input id="quick_message_hidden_uid" type="hidden" name="mail_recipient_search" value="0">'
$s &= '<label for="quick_message_focal">Temat:</label>'
$s &= '<input id="quick_message_focal" name="topic" type="text" value="">'
$s &= '<label for="quick_message_body">Tresc wiadomosci:</label>'
$s &= '<textarea id="quick_message_body" name="content" rows="5" cols="40"></textarea>'
$s &= '<div id="quick_message_accept_regulations">'
$s &= '<input id="form1_accept_regulations" name="accept_regulations" type="checkbox" value="1">'
$s &= '<label for="form1_accept_regulations">Akceptuje <a href="/profile/regulamin">regulamin</a></label></div>'
$s &= '<a href="#nogo" id="send_with_gift" onclick="return online_list.send_present_with_text();" class="wyslij">'
$s &= '<img alt="Wyslij wiadomosc z prezentem" src="http://1.s-nk.pl/img/friends/button_wyslijprezent" /></a>'
$s &= '<button id="quick_message_submit" class="type_3" type="submit"><table><tr><td class="btn_l"></td>'
$s &= '<td class="btn_m">Wyslij</td>'
$s &= '<td class="btn_r"></td></tr></table></button>'
$s &= '<div class="clear"></div></form>'
$s &= '</div>'
$s &= '<div id="quick_message_bottom"></div>'

_IEDocWriteHTML($oIE, $s)
$oForm = _IEFormGetObjByName ($oIE, "form1")
$oQuery = _IEFormElementGetObjByName ($oForm, "topic"); i tried topic and quick_message_focal
_IEFormElementSetValue ($oQuery, "example")

This is a good troubleshooting step. If it isn't working on the live site you need to look for other causes, like Javascript actions tied to the field.

Dale

Edited by DaleHohm

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

How did you get the HTML source you provided? If the form is hidden, it is not apparent from what you provided. Make certain that you are looking at interpretted HTML when you do this sort of thing by using a tool such as DebugBar.

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...