----basicPageAction.py
----BrowserDriver.py
--drivers
----chromedriver.md
--features
----BaiduFanyi.feature
--libraries
----allure-commandline
--pages
----BaiduFayi_page.py
----Indexpage.py
--steps
----Test_BaiduFanyi_steps.py
--utilities
----PathUtility.py
--.gitignore
--main.py
--pytest.ini
--requirements.txt
二、下载内容
2.1 WebDriver
chromedriver:
iedriver:
2.2 allure-commandline
allure 命令行工具,下载地址:https://github.com/allure-framework/allure2/releases
三、代码介绍
3.1 PathUtility.py
处理一些必要的文件路径事件
# @Software PyCharm # @Time 2021/11/13 9:53 下午 # @Author Helen # @Desc handle all folder path things import os import shutil BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BROWSER_CHROME = os.path.join(BASEDIR, 'drivers/chromedriver') REPORTPATH = os.path.join(BASEDIR, 'report') ALLURECOMMANDLINEPATH_LINUX = os.path.join(BASEDIR, 'libraries/allure-commandline/dist/bin/allure') ALLURECOMMANDLINEPATH_WINDOWS = os.path.join(BASEDIR, 'libraries/allure-commandline/dist/bin/allure.bat') REPORT_XMLPATH = os.path.join(REPORTPATH, 'xml') def create_folder(path): if not os.path.exists(path): os.mkdir(path) def delete_folder_and_sub_files(path): if os.path.exists(path): shutil.rmtree(path)