From ecb1bb8b964a64cb91e306b4870e1e750e953214 Mon Sep 17 00:00:00 2001 From: apailthorp Date: Fri, 20 Sep 2013 10:07:29 -0700 Subject: [PATCH 1/3] AcceptRules to use CheckBox rather than Select2 --- picpaste/webdriver/modules/pages/upload.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/picpaste/webdriver/modules/pages/upload.py b/picpaste/webdriver/modules/pages/upload.py index 50fc789..763f8e9 100644 --- a/picpaste/webdriver/modules/pages/upload.py +++ b/picpaste/webdriver/modules/pages/upload.py @@ -22,7 +22,7 @@ def __init__(self, driver): self.locator = locators["obscure_filename"] self.driver = driver -class AcceptRules(Select2): +class AcceptRules(CheckBox): def __init__(self, driver): self.locator = locators["accept_rules"] self.driver = driver @@ -51,10 +51,12 @@ def upload(self, image, storetime="30 Minutes", obscure_filename="basic", accept self.storetime.selected = "text=%s" % storetime self.obscure_filename.selected = "text=%s" % obscure_filename - self.accept_rules.selected = "text=%s" % accept_rules + if accept_rules == "Yes": + checkbox = self.driver.find_element_by_locator(locators['accept_rules']) + checkbox.click() button = self.driver.find_element_by_locator(locators['button']) button.click() p = Preview(self.driver).wait_until_loaded() - return p \ No newline at end of file + return p From be252a55f455f1d76132017c2fe9a937b55437bb Mon Sep 17 00:00:00 2001 From: apailthorp Date: Fri, 20 Sep 2013 10:11:26 -0700 Subject: [PATCH 2/3] Adding missing import --- picpaste/webdriver/modules/pages/upload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/picpaste/webdriver/modules/pages/upload.py b/picpaste/webdriver/modules/pages/upload.py index 763f8e9..80c1011 100644 --- a/picpaste/webdriver/modules/pages/upload.py +++ b/picpaste/webdriver/modules/pages/upload.py @@ -1,6 +1,7 @@ from saunter.po.webdriver.page import Page from selenium.webdriver.support.wait import WebDriverWait from saunter.po.webdriver.select import Select2 +from saunter.po.webdriver.checkbox import CheckBox import os.path from pages.preview import Preview From 5add9111fd857257c838f380ad6ecb24ac3b57f1 Mon Sep 17 00:00:00 2001 From: apailthorp Date: Fri, 20 Sep 2013 10:13:15 -0700 Subject: [PATCH 3/3] Fix the locator --- picpaste/webdriver/modules/pages/upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/picpaste/webdriver/modules/pages/upload.py b/picpaste/webdriver/modules/pages/upload.py index 80c1011..28500c3 100644 --- a/picpaste/webdriver/modules/pages/upload.py +++ b/picpaste/webdriver/modules/pages/upload.py @@ -10,7 +10,7 @@ 'button': 'css=input[type="submit"]', 'storetime': 'css=select[name="storetime"]', 'obscure_filename': 'css=select[name="addprivacy"]', - 'accept_rules': 'css=select[name="rules"]', + 'accept_rules': 'css=input[name="rules"]', } class StoreTime(Select2):