Vba and Excel: navigate url with tabindex

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

I'm trying to navigate a website as hundreds of time I've done. Probably I'm a little bit tired, anyway this time I cannot login because a particular framework with tabindex.

The usual strategy doesn't work (no errors but nothing happens).

HTML:
IE.document.getElementById("login_txt_user").Value = myId
IE.document.getElementById("login_txt_pw").Value = myCode
IE.document.getElementById("login_btn_login").Click

The HTML code:

HTML:
						<div id="login_lbl_user" >Username/e-Mail</div>
						<div id="login_txt_user" ><input  tabindex="1" type="text" name="USER" placeholder="Username/Mail"></div>
						  
						<div id="login_lnk_forgottenuser" ><A tabindex="-1" href="javascript:forgottenuserid();"  >
							Forgotten username? </A>
						</div>
						<div id="login_lbl_pw" >Password</div>
						<div id="login_txt_pw" ><input tabindex="2" type="password" name="PASSWORD"  placeholder="Password" autocomplete="off"></div>
						<div id="login_lnk_forgottenpassword">
							
								    <A tabindex="-1" href="javascript:forgottenpassword();" >
									Forgotten password?</A>
							
						</div>
						<div id="login_btn_login" ><A tabindex="3" href="javascript:loginUser();" >Login</A></div>

Any suggestions?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello everybody.

I'm trying to navigate a website as hundreds of time I've done. Probably I'm a little bit tired, anyway this time I cannot login because a particular framework with tabindex.

The usual strategy doesn't work (no errors but nothing happens).

HTML:
IE.document.getElementById("login_txt_user").Value = myId
IE.document.getElementById("login_txt_pw").Value = myCode
IE.document.getElementById("login_btn_login").Click

The HTML code:

HTML:
						<div id="login_lbl_user" >Username/e-Mail</div>
						<div id="login_txt_user" ><input  tabindex="1" type="text" name="USER" placeholder="Username/Mail"></div>
						  
						<div id="login_lnk_forgottenuser" ><A tabindex="-1" href="javascript:forgottenuserid();"  >
							Forgotten username? </A>
						</div>
						<div id="login_lbl_pw" >Password</div>
						<div id="login_txt_pw" ><input tabindex="2" type="password" name="PASSWORD"  placeholder="Password" autocomplete="off"></div>
						<div id="login_lnk_forgottenpassword">
							
								    <A tabindex="-1" href="javascript:forgottenpassword();" >
									Forgotten password?</A>
							
						</div>
						<div id="login_btn_login" ><A tabindex="3" href="javascript:loginUser();" >Login</A></div>

Any suggestions?


Ok, I figured it out this way:

Code:
Set frm = .document.forms(1)
frm.Item("USER").Value = myId
frm.Item("PASSWORD").Value = myCode
frm.submit

But something gets wrong: I am redirected to the following page (I cannot edit publicly the site name)...

https://xxxxxx.xxx.com/up-password/login/login_redirect.html

... all white except for the following message:

cookie TargetAppl not Found in request


What could it be?
 
Last edited:
Upvote 0
Ok, I figured it out this way:

Code:
Set frm = .document.forms(1)
frm.Item("USER").Value = myId
frm.Item("PASSWORD").Value = myCode
frm.submit

But something gets wrong: I am redirected to the following page (I cannot edit publicly the site name)...

https://xxxxxx.xxx.com/up-password/login/login_redirect.html

... all white except for the following message:

cookie TargetAppl not Found in request


What could it be?

No tips, suggestions, clues?
 
Upvote 0
Re your PM: I would stick with IE automation, particularly with web site logins. Other approaches (e.g. CreateDocumentFromUrl, XMLhttpRequest) are more difficult if you have to handle cookies and session ids.

For your issue, use your browser tools (F12 key) to see if there are any events on the username, password and login elements. If so, you probably need to trigger the same events, using either fireEvent or dispatchEvent.
 
Upvote 0
Re your PM: I would stick with IE automation, particularly with web site logins. Other approaches (e.g. CreateDocumentFromUrl, XMLhttpRequest) are more difficult if you have to handle cookies and session ids.

For your issue, use your browser tools (F12 key) to see if there are any events on the username, password and login elements. If so, you probably need to trigger the same events, using either fireEvent or dispatchEvent.

Could it be this?

Code:
<form NAME="Log_in" METHOD="POST" action="/siteminderagent/forms/login.fcc"  onSubmit="return submitForm();" autocomplete="off">
 
Upvote 0
Your frm.submit should handle that, but also try an "onsubmit" fireEvent or "submit" dispatchEvent on the form element. As I said, look for events on the input elements.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top