import pytest
import os
from selenium import webdriver
@pytest.fixture(name='chrome')
def chrome_driver():
driver = webdriver.Chrome()
driver.maximize_window()
yield driver
driver.close()
@pytest.fixture(name='firefox')
def firefox_driver():
driver = webdriver.Firefox()
driver.maximize_window()
yield driver
driver.close()
def open_url(driver, url):
driver.get(url)
@pytest.mark.demo1
def test_login(chrome):
open_url(chrome, "https://www.baidu.com")
if __name__ == '__main__':
pytest.main(['-m demo1', os.path.abspath(__file__)])