本文整理汇总了Python中cart.Cart.verifycontbtn方法的典型用法代码示例。如果您正苦于以下问题:Python Cart.verifycontbtn方法的具体用法?Python Cart.verifycontbtn怎么用?Python Cart.verifycontbtn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cart.Cart
的用法示例。
在下文中一共展示了Cart.verifycontbtn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test23andMeWebsite
# 需要导入模块: from cart import Cart [as 别名]
# 或者: from cart.Cart import verifycontbtn [as 别名]
class Test23andMeWebsite(unittest.TestCase):
@classmethod
def setUp(self):
self.driver = webdriver.Chrome('/Users/User1/Downloads/chromedriver')
self.driver.get('http://store.23andme.com/en-us/')
time.sleep(5)
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
# debug log
self.debugLogger = logging.getLogger('debuglogger')
debug_handler = logging.FileHandler('debug.log')
debug_handler.setFormatter(formatter)
self.debugLogger.addHandler(debug_handler)
# info log
self.infoLogger = logging.getLogger('infologger')
info_handler = logging.FileHandler('info.log')
info_handler.setFormatter(formatter)
self.infoLogger.addHandler(info_handler)
# error log
self.errLogger = logging.getLogger('errlogger')
err_handler = logging.FileHandler('err.log')
err_handler.setFormatter(formatter)
self.errLogger.addHandler(err_handler)
self.cartInst = Cart(self.driver)
self.billInst = Billing(self.driver)
self.shipInst = Shipping(self.driver)
self.verifyAddyInst = VerifyAddy(self.driver)
self.driver.save_screenshot('setup.png')
""" Check if the cart is empty or not """
def testWebsiteFunc(self):
print('testwebsitefunc')
try:
WebDriverWait(self.driver, 10).until(ec.visibility_of_element_located((By.LINK_TEXT, 'Add a kit.')))
addkitlink = self.driver.find_element_by_link_text('Add a kit.')
if addkitlink:
print('CART EMPTY')
addkitlink.click()
self.cartInst.additemstocart(5)
self.cartInst.sendkitnames()
self.cartInst.verifysubtotal()
self.cartInst.verifysavings()
self.cartInst.verifygrandtotal()
self.cartInst.verifycontbtn()
self.shipInst.fillOutForm()
assert 'verifyaddress' in self.driver.current_url
self.verifyAddyInst.verifyContent()
assert 'payment' in self.driver.current_url
self.billInst.verifyContent()
else:
print('CART NOT EMPTY')
self.cartInst.sendkitnames()
self.cartInst.verifysubtotal()
self.cartInst.verifysavings()
self.cartInst.verifygrandtotal()
self.cartInst.verifycontbtn()
self.shipInst.fillOutForm()
assert 'verifyaddress' in self.driver.current_url
self.verifyAddyInst.verifyContent()
assert 'payment' in self.driver.current_url
self.billInst.verifyContent()
except TimeoutException as te:
self.errLogger.error(te.message)
self.errLogger.error(te.stacktrace)
except ElementNotVisibleException as enve:
self.errLogger.error(enve.message)
self.errLogger.error(enve.stacktrace)
finally:
self.debugLogger.debug(self.driver.session_id)
self.driver.save_screenshot('testwebsitefunc.png')
@classmethod
def tearDown(self):
self.driver.save_screenshot('teardown.png')
self.driver.quit()