pyautotest's People
Forkers
zhangmy163 carrypink hanlen520 jason-000 kumamon2019s slash1988 zxx5655 cwy007 erinchenff venkoxie showfirebug rp517045939 amoonstar luciferhe666 liuhunan mixergit gdshine ultramanse 2zyyyyy zhanzi123 wj870208 imeilige tangchengzao baihei123456 jekinen monsterone sqq0216 heran0912 userwangjn brandonqu xuxushenlan niyoooooo xjbwlb day20071010 starstory yuanqi66 icanrong jinzilao chinacooker liang5564 yinxunjiang chenyiyi1 justatester123 jpc479 testfuntion dgx0922 likang2005608 wanlii fiddersik 521zheng darklii emuyi github653224 rfyan tang07070 mingyouyo zhugeshiye resery hj2wq zlinghuvip123 chenxiaozhu boxing20 test-xufan msnshow liousalready mark-zhang-007 karlwanghn 1987604 angzhang-2021 aiyouweiwei guiyul 605775776 xiaoyue12306 wmssy8566 qq249788471 wangweixi0209 chase001 crazy85128x xiaxuno1 504000313 qinguangzhong gshtan raehahaha joiechen chengwz999 lsly2970 baiyang0717 zhuhao528 ruitaoyue wusanpi825117918 liuh0394 heyaohua2020 timyangyyds tinalixx lzcge zengjxrsingstar runwangguo ysedongpyautotest's Issues
最近conftest突然报错, AttributeError:‘CollectReport’ object has no attriibute 'description'
试了py.xml 和py._xmlgen都不行
conftest 中的截图功能 有问题,单独运行时报错“AttributeError: 'NoneType' object has no attribute 'save_screenshot'”
conftest 中的截图功能 有问题,run_test运行时候没有错但是image中没有图片;单独运行 conftest 时报错“AttributeError: 'NoneType' object has no attribute 'save_screenshot'”
在直接终端运行“/usr/local/bin/python3.7 /Users/huishow/pyautoTest/test_dir/test_baidu.py”
运行失败,提示“ModuleNotFoundError: No module named 'page'”,是什么原因呢
代码是和你的“test_baidu.py”一样的
poium 0.6 怎么定义一组元素,poium0.3可以用PageElements,但是poium0.6没有NewPageElements
发现错误,conftest.py中new_report_time()路径错误
new_report_time() 方法中路径错误,return files[-1],当存在日志的时候,倒数第一个文件是__init__.py,所以save_screenshot方法中的路径就会错误,应该改成 return files[-2],才能正确获取到第一个日志文件夹
如果想打开多个网站,那么base_url如何配置,pytest.ini的配置机制是什么样的?
[pytest]
base_url = https://www.baidu.com
报告生成失败呢
在poium中的方法怎么使用page中的定位方式呢?
def get_text(self, css_selector):
"""
JavaScript API, Only support css positioning
Get element text, Only support css positioning
"""
js = 'return document.querySelector("{css}").textContent;'.format(css=css_selector)
return self.driver.execute_script(js)
使用:
page.get_text('css定位')
但是我在page中已经定义了:
login_btn = PageElement(css='#login > button', describe='登录按钮')
怎么样在page.get_text()中使用已经写好的的login_btn 定位呢?
我跑不起来,请问还维护么
环境paython3
conftest中的 from py.xml import html 这个包是导入的什么插件 总是报错 我找了半天没找到答案
import os
import pytest
from py.xml import html
from selenium import webdriver
from selenium.webdriver import Remote
from selenium.webdriver.chrome.options import Options as CH_Options
from selenium.webdriver.firefox.options import Options as FF_Options
from config import RunConfig
控制台输出
版本没问题,但是一直NameError: name 'driver' is not defined
2020-01-15 11:35:56,042 - INFO - 回归模式,开始执行✈✈!
============================= test session starts =============================
platform win32 -- Python 3.7.1, pytest-4.3.0, py-1.8.1, pluggy-0.13.1 -- C:\Users\bima\AppData\Local\Programs\Python\Python37\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.7.1', 'Platform': 'Windows-8.1-6.3.9600-SP0', 'Packages': {'pytest': '4.3.0', 'py': '1.8.1', 'pluggy': '0.13.1'}, 'Plugins': {'html': '2.0.0', 'metadata': '1.8.0', 'rerunfailures': '7.0'}, 'JAVA_HOME': 'F:\install\jdk1.8.0_111'}
rootdir: F:\Workspaces\pyautoTest, inifile:
plugins: html-2.0.0, metadata-1.8.0, rerunfailures-7.0
collecting ... collected 4 items
test_dir/test_baidu.py::TestSearch::test_baidu_search_case
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages_pytest\main.py", line 210, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages_pytest\main.py", line 250, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\hooks.py", line 286, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\manager.py", line 87, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages_pytest\main.py", line 271, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\hooks.py", line 286, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\manager.py", line 87, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pytest_rerunfailures.py", line 176, in pytest_runtest_protocol
INTERNALERROR> reports = runtestprotocol(item, nextitem=nextitem, log=False)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages_pytest\runner.py", line 87, in runtestprotocol
INTERNALERROR> rep = call_and_report(item, "setup", log)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages_pytest\runner.py", line 175, in call_and_report
INTERNALERROR> report = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\hooks.py", line 286, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\manager.py", line 87, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "C:\Users\bima\AppData\Local\Programs\Python\Python37\lib\site-packages\pluggy\callers.py", line 203, in _multicall
INTERNALERROR> gen.send(outcome)
INTERNALERROR> File "F:\Workspaces\pyautoTest\conftest.py", line 74, in pytest_runtest_makereport
INTERNALERROR> capture_screenshot(case_name)
INTERNALERROR> File "F:\Workspaces\pyautoTest\conftest.py", line 121, in capture_screenshot
INTERNALERROR> driver.save_screenshot(image_dir)
INTERNALERROR> NameError: name 'driver' is not defined
跑不起来,大佬给瞅瞅
刚下到本地跑了一下报错了
已经把需要的库都安装好
INTERNALERROR> File "D:\PycharmProjects\pyautoTest-master\conftest.py", line 99, in capture_screenshots INTERNALERROR> RunConfig.driver.save_screenshot(image_dir) INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'save_screenshot'
代码点击百度设置会报错无法识别到
设置是个鼠标浮停的效果,这里会报错, 怎么解决这个问题?
test_baidu.py
def test_baidu_search_setting(self, browser, base_url):
page.settings.click()
class BaiduPage(Page):
settings = PageElement(link_text="设置", describe="设置下拉框")
获取不到元素的text
def test_LoginBySms_Success(self, browser, base_url):
page = Login_Page(browser)
print(page.login_success.text)
在selenium 下无法获取元素的text
E AttributeError: 'NoneType' object has no attribute 'text'
AttributeError: 'CollectReport' object has no attribute 'description'
- python3 run_tests.py
回归模式,执行完成生成测试结果
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-4.6.3, py-1.8.0, pluggy-0.12.0 -- /bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.6.3', 'Platform': 'Linux-3.10.0-693.el7.x86_64-x86_64-with-centos-7.4.1708-Core', 'Packages': {'pytest': '4.6.3', 'py': '1.8.0', 'pluggy': '0.12.0'}, 'Plugins': {'metadata': '1.8.0', 'html': '1.21.1', 'rerunfailures': '7.0'}, 'BUILD_NUMBER': '34', 'BUILD_ID': '34', 'BUILD_URL': 'http://192.168.0.196:8081/job/crm_auto_test/34/', 'NODE_NAME': 'master', 'JOB_NAME': 'crm_auto_test', 'BUILD_TAG': 'jenkins-crm_auto_test-34', 'EXECUTOR_NUMBER': '1', 'JENKINS_URL': 'http://192.168.0.196:8081/', 'JAVA_HOME': '/home/gaofenyun/app/jdk1.8.0_211', 'WORKSPACE': '/home/gaofenyun/.jenkins/workspace/crm_auto_test'}
plugins: metadata-1.8.0, html-1.21.1, rerunfailures-7.0
collecting ... collected 0 items / 1 errors
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 206, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 249, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/manager.py", line 81, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 259, in pytest_collection
INTERNALERROR> return session.perform_collect()
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 495, in perform_collect
INTERNALERROR> items = self._perform_collect(args, genitems)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 534, in _perform_collect
INTERNALERROR> self.items.extend(self.genitems(node))
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 772, in genitems
INTERNALERROR> for x in self.genitems(subnode):
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/_pytest/main.py", line 774, in genitems
INTERNALERROR> node.ihook.pytest_collectreport(report=rep)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/manager.py", line 81, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pytest_html/plugin.py", line 519, in pytest_collectreport
INTERNALERROR> self.append_failed(report)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pytest_html/plugin.py", line 304, in append_failed
INTERNALERROR> self._appendrow('Error', report)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pytest_html/plugin.py", line 273, in _appendrow
INTERNALERROR> result = self.TestResult(outcome, report, self.logfile, self.config)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pytest_html/plugin.py", line 130, in init
INTERNALERROR> report=report, cells=cells)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/hooks.py", line 289, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/manager.py", line 87, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/manager.py", line 81, in
INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/usr/local/python3/lib/python3.6/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/home/gaofenyun/test_code/new_crm_poium/conftest.py", line 145, in pytest_html_results_table_row
INTERNALERROR> cells.insert(2, html.td(report.description))
INTERNALERROR> AttributeError: 'CollectReport' object has no attribute 'description'
这种错误是什么引起的呢,这是我通过jenkins 使用selenium grid插件启动的,在我本地是可以正常运行。是什么原因呢?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.