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.sstatic.net/kr8Nf.png
https://i.sstatic.net/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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Is there any way to call javascript function from web page source and use the same function in python? instead of using phantomJS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.