Vba and Excel: navigate url with tabindex

Nelson78

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

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Nelson78

Active Member
Joined
Sep 11, 2017
Messages
470
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
470
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
6,420
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
470
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
6,420
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,980
Messages
5,526,030
Members
409,680
Latest member
DonVito

This Week's Hot Topics

Top