0

HTML Login button : <a href="javascript:loginSendit(document.login_form);" tabindex="3"></a>

HTML User_id : <input name="userid" type="text" tabindex="1" class="login_input" value="" onfocus="check_userid_on()" onclick="check_userid_on()" onblur="check_userid_off()">

I attached the picture of user_id, user_pw, and sign-in button page source for better understanding.

https://i.stack.imgur.com/kr8Nf.png
https://i.stack.imgur.com/irZJz.png

In python, I want to insert user_id and user_pw then login in using login button that has a javascript function called loginsendit()

So far my code starts like

LOGIN_INFO = {
'userId': 'myidid',
'userPassword': 'mypassword123'

}

user_id = soup.find('input' , {'name': 'userid'})
user_id['value'] = LOGIN_INFO['userid']

user_pw = soup.find('input', {'name': 'userpw'})
user_pw['value'] = LOGIN_INFO['userPassword']


login_req = s.post('url', data='loginSendit()')
print(login_req.status_code)

But it only prints out 200 even if the password or username is wrong, which means my code doesn't let me log in.

Can you help me how to call this loginsendit() javascript func in Python?

1 Answers1

0

If you want to execute JavaScript then look for phantomjs - general tutorial, threads: Running javascript in Selenium using Python and Executing Javascript on Selenium/PhantomJS.

Daweo
  • 31,313
  • 3
  • 12
  • 25
  • Is there any way to call javascript function from web page source and use the same function in python? instead of using phantomJS – Woobin Joo Jan 22 '19 at 08:30