Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I trap a popup in Selenium 2 python
    primarykey
    data
    text
    <p>I just started using Selenium 2 tonight so this will be very basic (I hope...).</p> <p>I am trying to log onto my account at <a href="http://contentparadise.com/" rel="nofollow">http://contentparadise.com/</a></p> <p>I go to the sign in page <a href="https://www.contentparadise.com/signin.aspx" rel="nofollow">https://www.contentparadise.com/signin.aspx</a> 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.</p> <p>How do I detect and read this messagebox, and why doesn't the correct set go to the home page?</p> <p>I use the same code on another site, use the correct set, and it takes me to the home page as it should.</p> <p>Is this a case of the signin page using javascript? If you look at the source for the signin page, look for the string "<strong></strong>" to start that part of the form.</p> <p>Here's the code:</p> <pre><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() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload