I have been teaching myself Python over the last few months. My first project is a browser driver test case using the Selenium RC web driving framework (Not importing webdriver in my project though, so as not to confuse). Basically, my test case needs to hook into a refresh loop of a '.aspx' page that is written in JavaScript and HTML. This loop constantly refreshes this .aspx
page until a sel.is_text_present("foo")
condition is satisfied. After refreshing until the defined 'text' appears the script is supposed to click
a JavaScript button that appears along with the is_text_present
string. Upon executing the script Firefox opens and directs itself to the specific page and enters its refresh loop
, but when the text appears (i.e. the .aspx
page changes its state and loads a JavaScript table with a JavaScript button) the script doesn't execute the other branch of the loop. Here is a snippet of code which shows the logic I have implemented:
i = sel.is_text_present("Schedule") #text that the test case is 'waiting' for
while i != True:
print i
print "Waiting for job..."
sel.refresh()
else:
print "Job found..."
sel.click("id=Select")
sel.wait_for_page_to_load("30000")
sel.click("id=1")
sel.wait_for_page_to_load("30000")
print "Success!"
test_py_s_f_t_c() #calls this function again to repeat the test case
Does the logic of my loop statement instruct Firefox to refresh until it detects a string of text and then upon detecting this string to click a button? Is it possible to have wildcards in the button id if the name of the button is dynamic and changes?