Created
August 7, 2012 18:15
-
-
Save kennethkoontz/3287959 to your computer and use it in GitHub Desktop.
nextpage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nextPage(self): | |
"""Continue to the next page. | |
IE is notorious for not registering click events. Let's make sure when | |
we go to the next page the state has changed. | |
Try 3 times. With a second of elapsed time between each try. | |
""" | |
initial = self.surveyState.getHTMLAttribute('value') | |
self.contBtn.click() | |
current = self.surveyState.getHTMLAttribute('value') | |
attempts = 0 | |
while True: | |
if initial != current: | |
break | |
elif attempts >= 3: | |
break | |
self.contBtn.click() | |
time.sleep(1) | |
attempts += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CONTINUE_TRIES = 3
SLEEP = 1 # in seconds
def clickBtn(self, btn, isSuccessful, tries=1, delay=SLEEP):
'''click a button; allows X tries before it fails'''
def clickContinueBtn(self):
'''click the continue button'''