Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

innerText to variable


Best Answer Jackie Sztuk _Blackholyman , 13 October 2015 - 02:13 PM

Go to the full post »


  • Please log in to reply
4 replies to this topic
thenasos
  • Members
  • 7 posts
  • Last active: Oct 21 2015 07:08 AM
  • Joined: 21 Aug 2014

I am not able to force a HTML element into variable, it just show that HRGopen.Document.All.portletTitleText.innerText is unknown name.

After few hours of searching I am still facing same error.

SetTitleMatchMode, 2

HRG = https://somewebpagethatidonotlike.com/
#F::

HRGopen := ComObjCreate("InternetExplorer.Application")
HRGopen.Visible := true
HRGopen.Navigate(HRG)
while HRGopen.busy
Sleep 10
HRGopen.Document.All.MainContent_DropDownListCountry.Value := "LT"
HRGopen.Document.All.MainContent_CompanyName.Value := "NiceCompany"
HRGopen.Document.All.MainContent_UserName.Value := "[email protected]"
HRGopen.Document.All.MainContent_Password.Value := "veryhardpasswordindeeed"
HRGopen.Document.All.MainContent_LoginButton.Click()

WinWait, that new title after login
while HRGopen.busy
Sleep 10

TravelFrom := HRGopen.Document.All.portletTitleText.innerText     ;Ohh old gods of coding, why the smirk??..
;FromDate := HRGopen.Document.All.date.InnerText
;TravelTo := HRGopen.Document.All.E_LOCATION_1.Value
;ToDate := 

MsgBox From: %TravelFrom% ;

Return

x::
ExitApp



Jackie Sztuk _Blackholyman
  • Spam Officer
  • 3757 posts
  • Last active: Apr 03 2016 08:47 PM
  • Joined: 28 Feb 2012
✓  Best Answer
Without a url to the page or html of the page we can't really say

The all method return's only the first element found on the page even if there are more then one

Other then that i'd need to know more...
Helping%20you%20learn%20autohotkey.jpg?d

[AHK] Version. 1.1+ [CLOUD] DropBox ; Copy [WEBSITE] Blog ; About

thenasos
  • Members
  • 7 posts
  • Last active: Oct 21 2015 07:08 AM
  • Joined: 21 Aug 2014

I have noticed, it has 2 identical ID's, but still it should show first, as Jackie mentioned, right, right...?  :/

<td class="sidebar" id="LeftSidebar" valign="top" style="padding: 0px; table-layout: fixed;">
        <div id="CustomizationTravelPlannerSideBarTop"></div>

    <!-- Customization DIV positionned on top of each portlet. -->
    <div id="CustomizationMiniItineraryTop"></div>

    <div class="portletContainerDiv_Standard" id="MiniItinerary">
      <script type="text/javascript">var jsoMiniItinerary = new portlet("MiniItinerary");</script>
            
      <div class="portletHeaderDiv" id="portletHeaderId"> 
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tbody><tr>
			<td valign="top"><div class="text" id="portletTitleText">Itinerary</div></td>
			<td class="iconLeft"></td>
				<td align="right" class="iconBackground" valign="center" onclick="getPortlet(this).doMinimize(makeRelativeURL('https://Someamadeuslink.com/portalApp/application'), makeRelativeURL('https://https://Someamadeuslink.com/portalApp/application'));">
					<div class="iconMin" id="portletMinimizeDiv"></div>
				</td>	
		</tr>
		</tbody></table>

      </div>
          <div class="portletContentDiv" id="portletContent">     


Jackie Sztuk _Blackholyman
  • Spam Officer
  • 3757 posts
  • Last active: Apr 03 2016 08:47 PM
  • Joined: 28 Feb 2012
please try this tool https://www.dropbox....earner.exe?dl=0

point it at your element, take a screenshot and upload it to imgur.com and post a link to it here
Helping%20you%20learn%20autohotkey.jpg?d

[AHK] Version. 1.1+ [CLOUD] DropBox ; Copy [WEBSITE] Blog ; About

thenasos
  • Members
  • 7 posts
  • Last active: Oct 21 2015 07:08 AM
  • Joined: 21 Aug 2014

Work pc, not able to access.

Anyhoo, found the issue, the method itself works ok on other elements fine, it's just when entering dynamically generated divs and their elements, accuracy goes off..

 

Not it's only matter of finding how to point it in a smarter way.

 

Thanks for the time spared, your post did allow me to realize, what is exactly wrong with it. ;)