1.测试实例:
# -*- coding: UTF-8 -*-
import unittest
import os
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from utils.configfix import Config
from utils.logs import Logger
class Test_Baidu(unittest.TestCase):
URL = Config().getconfig('Config','URL',)
locator_kw = (By.ID, 'kw')
locator_su = (By.ID, 'su')
locator_result = (By.XPATH, '//div[contains(@class, "result")]/h3/a')
def setUp(self):
self.driver = webdriver.Firefox(log_path=r"E:\pythonproject\PythonSeleniumPrj\PythonSeleniumPrj\foxwatch.log")
self.driver.get(self.URL)
def tearDown(self):
self.driver.quit()
def test_search_0(self):
try:
Logger().logger.info("this is test!")
Logger().logger.info("this is just a test!")
#self.driver.find_element(*self.locator_kw).send_keys('pyth')
#self.driver.find_element(*self.locato