问题
I have 2 files-
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.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
I also have allure libraries added. Now I am running my 2 test cases by running the command:
pytest test_ABTesting.py
I keep getting this error:
AttributeError: module 'allure' has no attribute 'severity_level'
Not sure what it means.
来源:https://stackoverflow.com/questions/57851526/not-able-to-generate-allure-report-in-pytest-getting-attributeerror-module-a