# case2BugRefa **Repository Path**: yanggang0225/case2BugRefa ## Basic Information - **Project Name**: case2BugRefa - **Description**: 将bug信息记录在excel中,在禅道中根据用例编号关联bug信息 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-26 - **Last Updated**: 2024-01-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 功能介绍 ## 1. 软件包 > python 3.3 把 软件包的定义放宽 ,不需要init.py > selennium的 init.py 中定义了 别名 才可以引入 Chrome ## 2. Python编程规范 > https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_style_rules/#id21 > https://github.com/shendeguize/GooglePythonStyleGuideCN ## 3. PO >  https://martinfowler.com/bliki/PageObject.html 原文 > SELENIUM官方文档 https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/ ### PO 6原则 1. 公共方法代表页面提供的服务 [^解释]: 要封装页面中的功能(或者服务),比如点击页面中的元素,可以进入到新的页面,于是,可以为这个服务封装方法“进入新页面” 2. 不要暴露页面细节 [^解释]: 封装细节,对外只提供方法名(或者接口) 3. 不要把断言和操作细节混用 [^解释]: 封装的操作细节中不要使用断言,把断言放到单独的模块中,比如testcase 4. 方法可以return到新打开的页面 [^解释]: 点击一个按钮会开启新的页面,可以用return方法表示跳转,比如return MainPage()表示跳转到新的PO:MainPage 5. 不要把整页内容都放到PO中 [^解释]: 只为页面中重要的元素进行PO设计,舍弃不重要的内容 6. 相同的行为会产生不同的结果,可以封装不同结果 [^解释]: 一个动作可能产生不同结果,比如点击按钮后,可能点击成功,也可能点击失败,为两种结果封装两个方法,click_success和click_error ## 单例 1. 吴老师录制的一个视频 > 关于单例 https://www.aliyundrive.com/s/BBG17QWSjUy 2. 设计模式 https://www.cnblogs.com/wuxianfeng023/p/16962361.html ## plantuml 1.用图表显示代码的逻辑性 ## pip > pip freeze>requirements.txt > pip install -r requirements.txt > pip uninstall -r requirements.txt > requirements.txt 能被ide识别 > 默认是有版本信息的,有时候会安装失败 ## objprint > 码农高天 B站 ## F12定位技巧 > 1. 在console中执行setTimeout(function(){debugger},1000)可以在1s后冻结窗口,有的时候元素无法定位到就可以通过它来定位 ```python setTimeout(() => {debugger;}, 4000); ```