I just started using Selenium 2 tonight so this will be very basic (I hope...).
I am trying to log onto my account at http://contentparadise.com/
I go to the sign in page https://www.contentparadise.com/signin.aspx and am able to enter the id/pw, then submit. But even with the correct id/pw, it returns me to the signin page - with a small messagebox added with the words "The following error has occurred". Obviously the id/pw in the code is wrong, I'm trying to detect this as an error - but I get it even with my real id/pw.
How do I detect and read this messagebox, and why doesn't the correct set go to the home page?
I use the same code on another site, use the correct set, and it takes me to the home page as it should.
Is this a case of the signin page using javascript? If you look at the source for the signin page, look for the string "" to start that part of the form.
Here's the code:
from selenium import webdriver
import sys
import os
userID = "wajahbaru"
pw = "marmalade"
wdrv = webdriver.Firefox()
wdrv.get("https://www.contentparadise.com/signin.aspx")
print "Page #1 title is: " + wdrv.title; # should be "Sign In"
unamefield = wdrv.find_element_by_name("ctl00$ContentPlaceHolder1$txtUserName").send_keys(userID)
pwdfield = wdrv.find_element_by_name("ctl00$ContentPlaceHolder1$txtPassword").send_keys(pw)
pwdfield = wdrv.find_element_by_name("ctl00$ContentPlaceHolder1$btnLogin").click()
print "Page #2 title is: " + wdrv.title; # if logged in this should be "Content Paradise: Buy or Sell Software, 2D Content, 3D Models and Audio."
wdrv.get_screenshot_as_file("test.jpg")
wdrv.quit()