Getting confirmation window with Selenium-rc

I start the selenium server (v.2.0b2) and write a python script to run the test suite on my web server.

from selenium import webdriver
import selenium

selenium = selenium.selenium('127.0.0.1', 3333, '*firefox', 'http://localhost/')
selenium.start()
profile = webdriver.FirefoxProfile('selenium')
browser = webdriver.Firefox(profile)
browser.get('http://localhost:8080/index.html?no_auto_login=1')

I have a login button that displays a confirmation dialog, but it requires the server to pop up back and forth to it.

submit_button = browser.find_element_by_css_selector('#btnSubmit')
submit_button.click()
alert = browser.switch_to_alert()
assert alert.text == 'Server Login Error...'
alert.accept()

comments on elements after submit_button.click () and then calls selenium.is_confirmation_present () returns false

How can I wait for the confirmation window to appear? Why does selenium.is_confirmation_present () not return true?

+3
source share
1 answer

I did not work with Selenium 2.0 (web driver), but would suggest testing it with Thread.sleep (10). And if that works, then that means a conditional wait in your case.

0
source

All Articles