IE Automation (1 Viewer)

torz

Registered User.
Local time
Today, 14:54
Joined
Jun 21, 2014
Messages
73
Hi guys, I'm stuck on one bit of this automation, the login is working perfectly, once It logs in there is a button to expand all that is based in JS. I can't seem to work out how to get it to click the button to expand the whole menu, latest code is below:

Code:
Option Explicit

Function Checkpage()
Dim IE As Object
Dim lform As Object
Dim Document As Object
Dim item As Object

Set IE = New InternetExplorerMedium
IE.visible = True
IE.Navigate "https://the.site.we.goto.com/login.do"
While IE.Busy
DoEvents
Wend
Set lform = IE.Document.Forms(0)
lform("username").Value = "uesername"
lform("password").Value = "password"
lform.submit
While IE.Busy
DoEvents
Wend

item = IE.getElementsByName("expand_all").item(5).Click

End Function


The source - trying to get the Expand_Button / expand_all button to work but can't seem to get it! I could possibly get a bit more source code if required.

Code:
	<div id="purplenew">
		<div id="page-wrapper">

			<!-- Regular header with navigation -->
			<div id="global-header">
				<div class="leftlogo">
					<img src="./images/purple/logo.png" alt="LOGO" />
				</div>
				<div id="header">HEADERRR</div>
				<div id="userbar">
					<div id="userbar-welcome-message">Welcome  Blahblah
						blah</div>
					<div id="userbar-log-out">
						<a href="logoutPage.do">Log Out</a>
					</div>
				</div>
				<!--header navigation-->
				<!--  <div class="headingPart">
					<h2></h2>
				</div>  -->
				<!--End header navigation-->
				<div class="clear"></div>
			</div>

			<input type="button" class="Expand_Button" id="expand_all"
				title="Expand All" /> <input type="button" class="Collapse_Button"
				id="collapse_all" title="Collapse All" />

			<!-- <div id="main-content">-->


Here is the JS code for it as well

Code:
	$(function() {
		$("#expand_all").click(function() {
			$("#left-nav").jstree("open_all", "#left-nav");
		});
		$("#collapse_all").click(function() {
			$("#left-nav").jstree("close_all", "#left-nav");
		});

	});

Hope someone can point out what ive been missing, tried so many different ways and googled for hours but just cant work it out :confused:
 

torz

Registered User.
Local time
Today, 14:54
Joined
Jun 21, 2014
Messages
73
FINALLY got it

Set htmlDoc = IE.Document
Set htmlColl = htmlDoc.getElementsByTagName("input")
Do While htmlDoc.ReadyState <> "complete": DoEvents: Loop
For Each htmlInput In htmlColl
If Trim(htmlInput.Type) = "button" Then
htmlInput.Click
Exit For
End If
Next htmlInput

was all it eneded tacked on the end
 

torz

Registered User.
Local time
Today, 14:54
Joined
Jun 21, 2014
Messages
73
that must have been a total fluke because I can't get the next menu item to click!
 

torz

Registered User.
Local time
Today, 14:54
Joined
Jun 21, 2014
Messages
73
No one knows how to get the java links/functions to run using vba automation??

Someone must! :D
 

Users who are viewing this thread

Top Bottom