Skip to content
Advertisement

Python Selenium Logon

This code technically works to login just fine. However, on successful login it prints both login successful, and login incorrect. on failed login it only prints login incorrect.

I’m using python3, and selenium. I believe this may be a syntax error, but I’m just not sure how to fix it. I can hard-code the credentials of course, but want this to be usable by multiple parties.

JavaScript

Advertisement

Answer

I think this is what you are attempting to do.

JavaScript

Note, this will be a continuous loop if always incorrect, you may want to consider wrapping in a for loop with a range.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement