2 Copyright 2013 Emily O'Leary
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
17 from selenium import webdriver
18 from selenium.webdriver.common.by import By
19 from selenium.webdriver.support.ui import Select
20 from selenium.common.exceptions import NoSuchElementException
21 import unittest, time, re
24 def log_out(self, external):
25 self.driver = external.driver
26 self.driver.implicitly_wait(30)
27 self.base_url = external.base_url
28 self.verificationErrors = []
29 self.accept_next_alert = True
31 driver.get(self.base_url + "/")
32 external.assertTrue(util.is_element_present(self,By.CSS_SELECTOR, "div.button_action.header_dropdown_down"))
33 driver.find_element_by_css_selector("div.button_action.header_dropdown_down").click()
34 external.assertTrue(util.is_element_present(self,By.LINK_TEXT, "Log out"))
35 driver.find_element_by_link_text("Log out").click()
36 try: external.assertTrue(util.is_element_present(self,By.LINK_TEXT, "Create an account at this site"))
37 except AssertionError as e: self.verificationErrors.append(str(e))
38 try: external.assertTrue(util.is_element_present(self,By.LINK_TEXT, "Log in"))
39 except AssertionError as e: self.verificationErrors.append(str(e))