Vba and Excel: navigate url with tabindex

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
494
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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
494
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?


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:

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
494
Office Version
  1. 2007
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?
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
7,129
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.
 

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
494
Office Version
  1. 2007
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">
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
7,129
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,195
Messages
5,768,779
Members
425,494
Latest member
Ragamacam

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
Top