Jump to content

How to click and send a text to an <span> input bar?


Recommended Posts

Hi everyone, I'm learning AutoIt Script and trying to create a script that automates the opening of incidents.

There's some <input> boxes that I need to fill with a text and also some <select> lists, where I choose things like location and department. I believe that clicking on these lists and typing the item desired, I already can get what I want, without opening the list and selecting the <option> ... </option>.

The thing is that all of those things that I wished to get as object, by using "_IEGetObjById" and then _IEAction($object, "click", they are inaccessible because each of them are between <span>  </span>. That's what I think so... So please I need help, I there another way of getting those items as an object and then clicking or typing in them???

Link to comment
Share on other sites

Hi @Fernandin, and welcome to the AutoIt forums :welcome:

For more assistance, could you please post your script, and if it is possible, the link to the webpage you are trying to interact with?

If it is not possible, please post the source code of the webage, at least :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

10 minutes ago, Fernandin said:

So is this the reason of not getting the textbox by id as an object? 

Not necessarily.
The command _IEFormElementSetValue itself becomes invalid due to the preceding coding. Type the command in your editor by hand (not by Copy & Paste).

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

Fine, I typed the line on my own and then I got this:

--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: PrimaryUserTextbox, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType

 

Isn't the object inaccessible by id and/name because of the <span>?

Link to comment
Share on other sites

Nothing yert...

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (Spanwrapper_PrimaryUserTextBox)
--> IE.au3 T3.0-2 Error from function _IEGetObjByName, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType

There's a print screen of the table with the textbox where I pretend to type 

image.png.5e645dea48be93c5191f70929946988e.png

Link to comment
Share on other sites

24 minutes ago, Fernandin said:

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (Spanwrapper_PrimaryUserTextBox)

This is telling you that the span wasn't found. So now your job is to determine why. You previously posted code where you used an ID of "Spanwrapper_PrimaryUserTextBox". This doesn't exactly match the HTML that you posted (the case is different). Try fixing that and then report back.

P.S. Have you checked to see if the website used frames?

Link to comment
Share on other sites

Finally, it worked!

$frame = _IEFrameGetObjByName($page, "win_DivLoadIFrame_content") ;I just used this to take the window's frame as an object

$textbox = _IEGetObjById($frame, "PrimaryUserTextbox") ;And then this, taking the textbox inside the frame

Thank you guys for the support.

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