Entering a value in a selection box with no name or ID tags Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Stoke

Entering a value in a selection box with no name or ID tags  Topic is solved

02 Oct 2017, 09:38

I am trying to make a script to help with completing time sheets at work but have run into an issue on, unfortunately, the most important part. I cannot figure out how to enter text or select an option from one of several drop-down boxes because I cannot figure out how to reference them in the script, or if I'm referencing them right, I'm not sending the information I want correctly. I can't link the page directly since you'd need a company login to access it, but I'll try to include the relevant information.

Here is image of the selection boxes with the specific element's information below as it appears when the page first loads.

Code: Select all

<input type="text" style="" value="" autocomplete="off" spellcheck="false" placeholder="Search or Make Selection" title="">
And here it is with more context, including a hidden element that does have a name but doesn't seem to have any effect on the main selection box when I try to send values to it.

Code: Select all

<div class="view-large-select">
            <div class="view-large-select-input">
                <input type="text" style="" value="" autocomplete="off" spellcheck="false" placeholder="Search or Make Selection" title="">
                <img src="../cl/images/icons/gray_arrow_down.png">
            </div><div class="view-large-select-list text-left" id="view-large-select-list-pc59d239378d2ea26">
                <ul style="display: none;"></ul>
            </div>
                
            
            <div class="view-large-select-hidden">
                <input type="hidden" name="jobcategory[3]" value="">
            </div>
        </div>
If you click the drop-down arrow and select an option two major things change. The "title" in the first input element and the "value" in the hidden element. Note that the "value" of the hidden element is clearly a reference because that value isn't a job number and isn't present in any text in the selection box.

Code: Select all

<div class="view-large-select">
            <div class="view-large-select-input">
                <input type="text" style="" value="" autocomplete="off" spellcheck="false" placeholder="Search or Make Selection" class="has-selection" title="INFORMATION ABOUT JOB THAT MIRRORS TEXT IN THE BOX">
                <img src="../cl/images/icons/gray_arrow_down.png">
            </div>
                
            
            <div class="view-large-select-hidden">
                <input type="hidden" name="jobcategory[3]" value="A6963">
            </div>
        </div>

I've tried several different methods that I've found via these forums (a couple below) for changing the innertext, value, placeholder, etc. on both the visible element and the hidden one but none of them have worked. Most run without error but don't do anything apparent to the selection box.

Code: Select all

Loop % wb.document.getElementsByTagname("a").Length {
    If (wb.document.getElementsByTagname("a")[A_Index-1].innerText == "Search or Make Selection") {
        wb.document.getElementsByTagname("a")[A_Index-1].innerText := 1234
        break
		}
	}
	
	
While ( wb.document.getElementsByTagName( "div")[ A_Index - 1].innerText != "Search or Make Selection" )
         index 		:= A_Index - 1
wb.document.getElementsByTagName( "div")[ index].innerText := 1234
Anyone have any ideas on how to modify these boxes?
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Entering a value in a selection box with no name or ID tags

02 Oct 2017, 15:27

try using the .value property instead of the .innerText property on inputs
Stoke

Re: Entering a value in a selection box with no name or ID tags

02 Oct 2017, 15:44

Unfortunately, even after trying pretty much any property I could think of including value I still have no results.
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Entering a value in a selection box with no name or ID tags

02 Oct 2017, 15:53

It's a little hard to diagnose the problem, but it seems that the page is using a script to update the properties..
This is going to sound odd, have you tried re-parsing the DOM >after< the input value is changed?
In other words, loop through the DOM again after the 1st while loop.
Stoke
Posts: 1
Joined: 02 Oct 2017, 15:45

Re: Entering a value in a selection box with no name or ID tags

02 Oct 2017, 16:28

Sorry, this is all pretty new to me, what exactly do you mean by "re-parsing the DOM"? Would that be running the script search, manually updating the field, then running the script again?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, hiahkforum, jchestnut, mcd, ShatterCoder and 95 guests