Python 无法在pytest中生成诱惑报告。获得';属性错误:模块';诱惑';没有属性';严重性等级'';
我有两个文件- conftest.py:Python 无法在pytest中生成诱惑报告。获得';属性错误:模块';诱惑';没有属性';严重性等级'';,python,selenium-webdriver,pytest,allure,Python,Selenium Webdriver,Pytest,Allure,我有两个文件- conftest.py: import pytest from selenium import webdriver driver = None @pytest.fixture(autouse = True) def browserSetAndClose(): global driver EXE_PATH = r'C:\Users\1602746\Softwares\chromedriver.exe' chromeOptions = webdriver
import pytest
from selenium import webdriver
driver = None
@pytest.fixture(autouse = True)
def browserSetAndClose():
global driver
EXE_PATH = r'C:\Users\1602746\Softwares\chromedriver.exe'
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(executable_path = EXE_PATH, options =
chromeOptions, desired_capabilities = chromeOptions.to_capabilities())
driver.implicitly_wait(10)
driver.maximize_window()
driver.get('http://the-internet.herokuapp.com/')
yield driver
driver.quit()
test_ABTesting.py:
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
import conftest
@pytest.fixture
def goToABTestingPage():
wait = WebDriverWait(conftest.driver, 10)
wait.until(expected_conditions.element_to_be_clickable((By.XPATH, "//a[starts-with(@href, '/abtest')]"))).click()
def test_abTest_header(goToABTestingPage):
a = conftest.driver.find_element_by_css_selector("h3").text
assert 'A/B Test' in a
def test_abTest_paragraph(goToABTestingPage):
a = conftest.driver.find_element_by_xpath("//p[contains(text(),'Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through).')]").text
assert 'Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through).' in a
我还添加了诱惑库。现在,我通过运行以下命令来运行我的2个测试用例:
pytest\u ABTesting.py
我不断地发现这个错误:
AttributeError:模块'allure'没有属性'severity\u level'
不知道这是什么意思。我在这里还发现了一个类似的问题,没有得到回答:hoefling有好运吗?