Jump to content

Where is the problem ? please help me


Go to solution Solved by SmOke_N,

Recommended Posts

Next time, please post the actual code rather than a screenshot. :thumbsup:

There isn't a object with a name of "submit", so that's the first issue. Not positive, but the second issue appears to be due to your use of _IEGetObjByName instead of _IEFormElementGetObjByName.

Try using _IEFormGetCollection along with _IEFormElementGetObjByName and let us know how that works for you.

P.S. Welcome to the forums!

Edited by Danp2
Link to comment
Share on other sites

Next time, please post the actual code rather than a screenshot. :thumbsup:

There isn't a object with a name of "submit", so that's the first issue. Not positive, but the second issue appears to be due to your use of _IEGetObjByName instead of _IEFormElementGetObjByName.

Try using _IEFormGetCollection along with _IEFormElementGetObjByName and let us know how that works for you.

P.S. Welcome to the forums!

 

How I can exactly do that can you please help me ? :)

 

#include <IE.au3>

Call ("SignIn")

Func SignIn ()
Global $oIE = _IECreate ("http://www.car.gr/users/login")

Local $username = _IEFormElementGetObjByName ($oIE,"ql_user")
Local $password = _IEFormElementGetObjByName ($oIE,"ql_pass")
Local $button = _IEGetObjByName ($oIE,"submit")

_IEFormElementSetValue ($username,"5121406")
_IEFormElementSetValue ($password,"...")

_IEAction ($button, "click")

EndFunc

Here is my code right now. And what is wrong with submit button ? It says type=submit but why there isnt name=?

Sorry for bad english

Link to comment
Share on other sites

#include <IE.au3>

Local $oIE, $oForm, $oText

$oIE = _IECreate ("http://www.car.gr/users/login")

$oForm = _IEFormGetCollection ( ByRef $o_object [, $i_index = -1] )
$oText = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oText, "demo")

$oText = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oText, "demo")
_IEFormSubmit($oForm)

I did something like this but not works  :geek:

Link to comment
Share on other sites

$oForm = _IEFormGetCollection ($oIE, 0) ; retrieves first form
#include <IE.au3>

Local $oIE, $oForm, $oText

$oIE = _IECreate ("http://www.car.gr/users/login")

$oForm = _IEFormGetCollection ($oIE, 0)
$oText = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oText, "demo")

$oText = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oText, "demo")
_IEFormSubmit($oForm)

and here is the errors.

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\THE-WALKING\Desktop\tutorial.au3"    
--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType
--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType
--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 Error from function _IEFormSubmit, $_IEStatus_InvalidObjectType
>Exit code: 0    Time: 11
Link to comment
Share on other sites

There are two forms on this page. Turns out that you need the second one:

#include <IE.au3>

Local $oIE, $oForm, $oText

$oIE = _IECreate ("http://www.car.gr/users/login")
$oForm = _IEFormGetCollection ($oIE, 1)

$oText = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oText, "demo")

$oText = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oText, "demo")

_IEFormSubmit($oForm)
Link to comment
Share on other sites

 

There are two forms on this page. Turns out that you need the second one:

#include <IE.au3>

Local $oIE, $oForm, $oText

$oIE = _IECreate ("http://www.car.gr/users/login")
$oForm = _IEFormGetCollection ($oIE, 1)

$oText = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oText, "demo")

$oText = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oText, "demo")

_IEFormSubmit($oForm)

 

Just tried them and error.. Can you please do a program that writes ''demo'' in the boxes on http://www.car.gr/users/login and share the code ? Thank you so much btw.

Link to comment
Share on other sites

Using last code you posted and here is errors..
 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\THE-WALKING\Desktop\tutorial.au3"    
--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType
--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType
--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 Error from function _IEFormSubmit, $_IEStatus_InvalidObjectType
>Exit code: 0    Time: 2.198
Edited by CemalSenturk
Link to comment
Share on other sites

I downloaded the IE.au3 from this topic and it worked :)

'?do=embed' frameborder='0' data-embedContent>>

And I have another problem :)

My code is here:
 

#include <IE.au3>

Call ("SignIn")

Func SignIn()
Local $oIE, $oForm, $oText

$oIE = _IECreate ("http://www.car.gr/users/login")
$oForm = _IEFormGetCollection ($oIE, 1)

$oText = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oText, "...")

$oText = _IEFormElementGetObjByName($oForm, "password")
_IEFormElementSetValue($oText, "...")

_IEFormSubmit($oForm)

_IENavigate($oIE, "http://www.car.gr/classifieds/tractors/edit/5121406/#details")



EndFunc

And I want to click a button but _IEFormSubmit($oForm) didnt work.

Source is like this.

<div class="form-actions">
<button class="btn btn-primary" type="submit">Name of Button</button>
</div>

Edit : After that I need to kill the Internet Explorer by automatically for calling another function. How to do that?

Edited by CemalSenturk
Link to comment
Share on other sites

1) You should never post your login name and password on the open forum!

2) I don't understand. Are you saying that you want to click another button that is on the new page after the _IENavigate?

3) Look at _IEQuit in the help file

1) Sorry I forget to change

2) Yes exactly that :)

Link to comment
Share on other sites

And I want to click a button but _IEFormSubmit($oForm) didnt work.

Source is like this.

<div class="form-actions">
<button class="btn btn-primary" type="submit">Name of Button</button>
</div>

I can't find anything resembling this html on the webpage that your prior code referenced.

You will need to provide more details. Exactly which button are you attempting to click? Post your code that shows what you have tried thus far.

Link to comment
Share on other sites

Source is like I posted. There is no button id or button name. Here you can see all the details tab (navigated new page)
 
<div class="tab-pane active" id="details">
<h2>Στοιχεία></h2>
<p>...</p>
<p>...</p>
<form class="form-horizontal"
action="/classifieds/tractors/edit/5121406/#details"
method="post">
<input name="dealer_id" type="hidden" value=""></input>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<fieldset>...</fieldset>
<p class="alert alert-warning"</p>
<fieldset>...</fieldset>
<div class="form-actions">
<button class="btn btn-primary" type="submit">Σώσε αλλαγές</button>
</div>
</form>
</div>

I have tried so far this code

$oFound = ""
Local $oBtns = _IETagNameGetCollection($oIE, "button")
For $oBtn In $oBtns
    If String($oBtn.classname) = "btn btn-primary" Then
     $oFound = $oBtn
   EndIf
Next
If IsObj($oFound) Then
 _IEAction ($oFound, "click")
 MsgBox(16, "Success", "Password23 with a captial P (Roles have been set)")
Else
 MsgBox(16, "Failed", "Not found.")
EndIf

and this one. but no one is working
 

$oButtons = _IETagNameGetCollection ($oIE, "div") ; not sure about input
For $oButton In $oButtons
If $oButton.class = "btn btn-primary" Then
_IEAction ($oButton, "click")
ExitLoop
EndIf
Next

My Operating System is : Windows 7 x64 Ultimate SP1

My IE version is : last updated 11.0.9600.17358

Edited by CemalSenturk
Link to comment
Share on other sites

There are multiple forms on the webpage. You could try something like this:

Local $oForms = _IEFormGetCollection($oIE)
For $oForm In $oForms
    If $oForm.Action = '/classifieds/tractors/edit/5121406/#details' Then
        _IEFormSubmit($oForm)
        ExitLoop
Next

Edit: The following appears to get a direct reference to the form without the looping --

Local $oDiv = _IEGetObjById($oIE, "details")
$oForm = _IETagNameGetCollection($oDiv, "form", 0)
Edited by Danp2
Link to comment
Share on other sites

  • Moderators

CemalSenturk,

We do not permit multiple accounts. Please stick to your existing account - I have deleted the CemalSenturk1 account you just created. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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