Link to home
Start Free TrialLog in
Avatar of jimmylew52
jimmylew52Flag for United States of America

asked on

How to test the ability of a website to be logged into.

I need to test the ability of a website to be logged into. Software, script or something to log into a website and send a report by email to report if the website could be logged into or not. needs to run on Windows 2008R2.
ASKER CERTIFIED SOLUTION
Avatar of Justin Stear
Justin Stear
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jimmylew52

ASKER

Python run on Linux, I need to run this on Windows 2008R2. We are a windows only shop.
Yes, Python does run on Linux, but you can also run it on Windows.

http://www.winservermart.com/HowTo/Install-Python-In-Windows-Server.aspx
So I see. Install python for windows but i have no idea how to get this to work. I don't see where it is installed. How do I get this script to run?
If I'm doing this right:  
I moved the python directory to c:\python
I savde the script to a file test.py

C:\python\python35\python test.py

I get:

File "test.py", line 12
print result^

SyntaxError: Missing parentheses in call to 'print'
Using python 3:    corrected code

#We need urllib module
import urllib.parse
import urllib.request
#These are the user and password parameters, check that field names are the same at the page form and put your real user and password values on myuser and mypassword
params = urllib.parse.urlencode({'username': 'UID', 'password': 'password', 'submit' : 'login'})
#This is the url of the login page, put the real url here
site = "https://mysite.mycompany.com"
#We save the result of the post in variable f
f = urllib.request.urlopen(site, params)
#We read the result
result = f.read()
#We print the result, so we can see if we are logged in
#print result
result = open('c:\\phython.html',w)
#Finished, so we close f
f.close()

Still getting error:

TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str.

I think the question was answered and I will open a question in python for the answers to the error.
Not complete answer but farther along than I was.