Navigating a menu with Edge Browser controls (1 Viewer)

wackywoo105

Registered User.
Local time
Today, 11:33
Joined
Mar 14, 2014
Messages
203
I want to navigate a menu and change a password. I can enter the details but do not know how to select the various menu options to get to the password page. I cannot just navigate to the URL as for some reason it doesn't load the password page properly. I'm also not sure how to click the final "confirm update" button.

Code:
Need to click the following one after the other:
<a href="#" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#nav-main" aria-expanded="false" aria-controls="navbar">Menu <em class="fa fa-bars"></em></a>

<a href="#" data-toggle="dropdown" aria-expanded="true"><i class="fa fa-gear"></i>Settings</a>

<a href="#" class="dropdown-item" data-navigation-link-item="" data-target-id="divMainContainer" data-ajax-url="/HomePortal/UserManagement/ChangePassword">Change Password</a>


Input data is fine:
<input class="form-control" id="CurrentPassword" name="CurrentPassword" type="password">
Me.EdgeBrowser0.ExecuteJavascript "document.getElementById('CurrentPassword').value =" & Chr(34) & "testPW123£" & Chr(34) & ";"

<input class="form-control" id="Password" name="Password" type="password">
Me.EdgeBrowser0.ExecuteJavascript "document.getElementById('Password').value =" & Chr(34) & "testPW123£" & Chr(34) & ";"

<input class="form-control" id="ConfirmPassword" name="ConfirmPassword" type="password">
Me.EdgeBrowser0.ExecuteJavascript "document.getElementById('ConfirmPassword').value =" & Chr(34) & "testPW123£" & Chr(34) & ";"

Now click this. Easy as has ID.
<input class="btn btn-success" data-ajax-url="/HomePortal/UserManagement/ChangePassword" data-btn-cancel-class="btn-danger" data-btn-cancel-label="Cancel" data-btn-ok-class="btn-success" data-btn-ok-label="Confirm Update" data-btn-save="" data-content="You are changing your password. Please confirm to proceed with the change." data-popout="true" data-source-id="divMainContainer" data-target-id="divMainContainer" data-title="Confirmation" data-toggle="confirmation" id="btnUpdate" name="btnUpdate" type="button" value="Update" data-original-title="" title="">

Not sure how to click this as no ID.
<a href="#" class="btn btn-success" data-apply="confirmation"><i class="glyphicon glyphicon-ok"></i> Confirm Update</a>

Can anyone help?
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:33
Joined
Sep 21, 2011
Messages
14,310
@Edgar_ appears to be the guru for activating Web pages

@arnelgp also

See what they have to say.
Might have to give them the actual urls, so they can see how the pages are constructed.
 

Edgar_

Active member
Local time
Today, 13:33
Joined
Jul 8, 2023
Messages
430
<a href="#" class="dropdown-item" data-navigation-link-item="" data-target-id="divMainContainer" data-ajax-url="/HomePortal/UserManagement/ChangePassword">Change Password</a>
Have you tried using that URL? /HomePortal/UserManagement/ChangePassword

Let's say the URL before clicking the Change Password menu is https://www.somepage.com/user, maybe all you need is to add the rest and it will look like: https://www.somepage.com/user/HomePortal/UserManagement/ChangePassword

It would be easier if you share the website link so we can see everything together. Right now, you're giving us parts of the source when it's better to have the whole picture to make the best choice. If we know how many <a> tags there are on the website, we can easily click on the first three and the last one in your post. Sometimes, elements only appear after certain actions, so it's important to consider the entire HTML code and how it responds to different things like data, layout, and user actions. Understanding the whole context helps in figuring out the best approach. If you're not willing to share it, you can figure it out yourself by simply using document.getElementsByTagName('a')[n].click, where "n" is the number you would be testing from 0 to whatever, until you find the right one. Use dev tools.

@Edgar_ appears to be the guru for activating Web pages
Thank you, Gasman, I'm here to help and share whatever I know the best I can
 

wackywoo105

Registered User.
Local time
Today, 11:33
Joined
Mar 14, 2014
Messages
203
Many thanks. The website is a pass worded NHS site, so sadly I cannot share a link. With your help I have found the correct number 'A' for change password (it's 6). inner HTML = 6__Change Password.

I can't navigate to the change password url as the page loads bare with no formatting and clicking update doesn't work.

Dev tools is giving
Code:
document.getElementsByTagName('a')[6].click
ƒ click() { [native code] }
when I try to click 'a' number 6 in VBA the code
Code:
Me.EdgeBrowser0.ExecuteJavascript "document.getElementsByTagName('a')[6].click;"
just does nothing.
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:33
Joined
Sep 21, 2011
Messages
14,310
So ask the NHS It dept.
 

wackywoo105

Registered User.
Local time
Today, 11:33
Joined
Mar 14, 2014
Messages
203
So ask the NHS It dept.
Sadly that is not an option. It's not the NHS anyway, it's outsourced to capita. The IT section is hidden far behind a script driven customer services department with no way to access it. If I ask customer services a question any more difficult that what their name is they go cross-eyed.
 
Last edited:

wackywoo105

Registered User.
Local time
Today, 11:33
Joined
Mar 14, 2014
Messages
203
It returned the function, instead of executing it. I guess forgot the parentheses. Try this:
Me.EdgeBrowser0.ExecuteJavascript "document.getElementsByTagName('a')[6].click();"

Epic stuff. That works. Many thanks.
 

Users who are viewing this thread

Top Bottom