{"id":463479,"date":"2025-06-15T21:00:49","date_gmt":"2025-06-15T21:00:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463479"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463479","title":{"rendered":"<span>\u041f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u043b\u043e\u0433\u0438\u043d \u0432 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u0430\u0445? \u0420\u0435\u0448\u0430\u0435\u043c \u0441 Playwright \u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u0432\u0440\u0435\u043c\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u041a\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442\u044b \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u043f\u0440\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438 \u0438 \u043a\u043e\u0434\u0435\u0440\u044b! \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c: \u043f\u0438\u0448\u0435\u0448\u044c \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f UX, \u0432\u0441\u0451 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u2014 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441 \u043d\u0443\u043b\u044f: \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043d\u043e\u043f\u043a\u0430. \u041a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0443 \u0442\u0435\u0441\u0442\u043e\u0432 \u0430\u043c\u043d\u0435\u0437\u0438\u044f! \u042d\u0442\u043e \u0431\u0435\u0441\u0438\u0442, \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u0434 \u0432 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0443. \u0414\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u043b\u043e\u0433\u0438\u043d \u043d\u0430 \u0441\u0432\u0430\u043b\u043a\u0443 \u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u0441\u0451 \u0441 Playwright \u0438 Python.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0437\u043b\u043e<\/h3>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u0442\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u0432\u0445\u043e\u0434\u044f \u0432 \u0434\u043e\u043c, \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u0441\u0432\u043e\u0435\u0439 \u0441\u043e\u0431\u0430\u043a\u0435. \u0412\u043e\u0442 \u0447\u0442\u043e \u0431\u0435\u0441\u0438\u0442:<\/p>\n<ul>\n<li>\n<p><strong>\u0422\u043e\u0440\u043c\u043e\u0437\u0430<\/strong>: \u041a\u0430\u0436\u0434\u044b\u0439 \u043b\u043e\u0433\u0438\u043d \u2014 \u044d\u0442\u043e + ~5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043a \u0442\u0435\u0441\u0442\u0443. \u0423\u043c\u043d\u043e\u0436\u044c \u043d\u0430 100 \u0442\u0435\u0441\u0442\u043e\u0432, \u0438 \u0442\u044b \u0443\u0436\u0435 \u0432\u0430\u0440\u0438\u0448\u044c \u043a\u043e\u0444\u0435, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0437\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u0434 \u2014 \u043f\u043e\u043c\u043e\u0439\u043a\u0430<\/strong>: \u041f\u0438\u0445\u0430\u0442\u044c \u0448\u0430\u0433\u0438 \u043b\u043e\u0433\u0438\u043d\u0430 \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u00abHello, World!\u00bb \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b. \u041d\u0443 \u0442\u0430\u043a\u043e\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u0436\u0438\u0442\u044c \u0442\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f. \u0418 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c. Playwright \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438 Python \u043d\u0430\u043c \u0432 \u043f\u043e\u043c\u043e\u0449\u044c.<\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0432\u0441\u0435\u0445<\/h3>\n<p>\u0412 Playwright \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u042d\u0442\u043e \u0442\u0438\u043f\u0430 \u0442\u0432\u043e\u044f \u0441\u0435\u0441\u0441\u0438\u044f, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043a\u0443\u043a\u0438, localStorage \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0432\u043a\u0443\u0441\u043d\u043e\u0441\u0442\u0438. \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u2014 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u043e\u0431\u0449\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0430\u0441\u0442\u0438\u0441\u044c \u0432 \u043d\u0451\u043c, \u043a\u0430\u043a \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u0430\u0441\u0442\u0431\u0438\u0449\u0435. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0445 \u043b\u043e\u0433\u0438\u043d\u043e\u0432, \u0432\u0441\u0451 \u043b\u0435\u0442\u0430\u0435\u0442, \u0432\u0441\u0435 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b.<\/p>\n<p>\u041d\u043e \u043c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438: \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0431\u0435\u0440\u0451\u043c \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043d\u043e\u0432\u044b\u0439. \u0410 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u0437\u0430\u043c\u0443\u0442\u0438\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @use_session, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c: \u00ab\u042d\u0439, \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0445\u043e\u0447\u0435\u0442 \u0432 \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u0442\u0451\u043b!\u00bb \u041f\u043e\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u0434.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c: \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b \u0438 \u043a\u043e\u0434<\/h3>\n<h4>\u0428\u0430\u0433 1: \u0424\u0438\u043a\u0441\u0442\u0443\u0440\u044b \u2014 \u043d\u0430\u0448\u0435 \u0432\u0441\u0451<\/h4>\n<p>\u0412 conftest.py \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043a\u0430\u043a \u0448\u0432\u0435\u0439\u0446\u0430\u0440\u0441\u043a\u0438\u0435 \u0447\u0430\u0441\u044b. \u0427\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u041e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/strong>: \u041e\u0434\u0438\u043d \u043d\u0430 \u0432\u0441\u044e \u0441\u0435\u0441\u0441\u0438\u044e, \u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/strong>: \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u0433\u0434\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441\u0442\u0443\u0440\u0430 page<\/strong>: \u0423\u043c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0430\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c, \u0433\u043b\u044f\u0434\u044f \u043d\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441\u0442\u0443\u0440\u0430 <\/strong>authorize<strong>:<\/strong> \u041b\u043e\u0433\u0438\u043d\u0438\u0442\u0441\u044f \u0440\u0430\u0437 \u0438 \u0432\u0441\u0451.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0428\u0430\u0433 2: \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @use_session<\/h4>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043a\u0430 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c \u2014 \u0442\u0435\u0441\u0442 \u0431\u0435\u0436\u0438\u0442 \u0432 \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0432 \u043d\u043e\u0432\u044b\u0439. \u0412\u0441\u0451, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0445 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0428\u0430\u0433 3: \u041f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u044b<\/h4>\n<p>\u0421\u0442\u0430\u0432\u0438\u0448\u044c @use_session \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\/\u0442\u0435\u0441\u0442 \u2014 \u0438 \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0431\u0449\u0443\u044e \u0441\u0435\u0441\u0441\u0438\u044e. \u041d\u0435 \u0441\u0442\u0430\u0432\u0438\u0448\u044c \u2014 \u0442\u0435\u0441\u0442 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 conftest.py<\/h3>\n<pre><code class=\"python\">import allure import pytest from playwright.sync_api import sync_playwright  from src.pages.auth_page import AuthPage from src.pages.landing_page import LandingPage  def use_session(cls):     cls.use_session = True     return cls  @pytest.fixture(scope=\"session\") def playwright():     with sync_playwright() as p:         yield p  @pytest.fixture(scope=\"session\") def browser(playwright):     browser = playwright.chromium.launch(headless=True)     yield browser     browser.close()  @pytest.fixture(scope=\"session\") def shared_context(browser, authorize):     context = browser.new_context()     yield context     context.close()  @pytest.fixture(scope=\"function\") def new_context(browser):     context = browser.new_context()     yield context     context.close()  @pytest.fixture(scope=\"function\") def page(request, new_context, shared_context, domain):     context = shared_context if hasattr(request.cls, \"use_session\") else new_context     page = context.new_page()     page.goto(domain, wait_until=\"load\", timeout=3000)     yield page     page.close()  @pytest.fixture(scope=\"session\", autouse=True) def authorize(shared_context, domain):     page = shared_context.new_page()     page.goto(domain, wait_until=\"load\", timeout=3000)          with allure.step(\"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430\"):         landing = LandingPage(page, domain)         landing.open()         landing.click_login_button()                  auth = AuthPage(page, domain)         auth.fill_login(\"testuser@example.com\")         auth.fill_password(\"supersecret\")         auth.click_submit()          page.close()<\/code><\/pre>\n<h4>\u0427\u0442\u043e \u0442\u0443\u0442 \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f:<\/h4>\n<ul>\n<li>\n<p><strong>shared_context<\/strong>: \u0416\u0438\u0432\u0451\u0442 \u0432\u0441\u044e \u0441\u0435\u0441\u0441\u0438\u044e, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043d\u0451\u043c \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p><strong>new_context<\/strong>: \u041d\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u043e\u0431\u0449\u0438\u0439 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>page<\/strong>: \u0421\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 \u0442\u0435\u0441\u0442\u0430 \u0438 \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0440\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>authorize<\/strong>: \u0417\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u043b\u0438\u0441\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u2014 \u0438 \u0432\u0441\u0451, \u043c\u043e\u0436\u043d\u043e \u043a\u0443\u0440\u0438\u0442\u044c \u0431\u0430\u043c\u0431\u0443\u043a.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 test.py<\/h3>\n<p>\u0412\u043e\u0442 \u0442\u0435\u0431\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043a\u043e\u0442\u0438\u043a\u0430\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">import allure import pytest from conftest import use_session from src.pages.cat_page import CatPage  @use_session class TestCatPage:     @allure.title(\"\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0442\u0438\u043a\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435\")     def test_check_cats(self, page, domain):         cats = CatPage(page, domain)         cats.open()         assert cats.count_cats() &gt; 0, \"\u0413\u0434\u0435 \u043a\u043e\u0442\u0438\u043a\u0438? \u042f \u0442\u0440\u0435\u0431\u0443\u044e \u043a\u043e\u0442\u0438\u043a\u043e\u0432!\"<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0442\u0438\u043a\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u041b\u043e\u0433\u0438\u043d? \u041a\u0430\u043a\u043e\u0439 \u043b\u043e\u0433\u0438\u043d? \u041e\u043d \u0443\u0436\u0435 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c!<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e:<\/h3>\n<ul>\n<li>\n<p><strong>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/strong>: \u0422\u0435\u0441\u0442\u044b \u0431\u0435\u0433\u0443\u0442, \u043a\u0430\u043a \u0441\u043f\u0440\u0438\u043d\u0442\u0435\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c<\/strong>: \u0425\u043e\u0447\u0435\u0448\u044c \u0441 \u043b\u043e\u0433\u0438\u043d\u043e\u043c, \u0445\u043e\u0447\u0435\u0448\u044c \u0431\u0435\u0437 \u2014 \u0432\u0441\u0451 \u043f\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u0434 \u0447\u0438\u0441\u0442\u044b\u0439<\/strong>: \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u043e\u0432 \u0441 \u0448\u0430\u0433\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451. \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0432\u043e\u0438 \u0442\u0435\u0441\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0432\u0435\u0447\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u043d\u044b. Playwright, Python \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438 \u2014 \u044d\u0442\u043e \u0432\u0441\u0451 \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0437\u0430\u0448\u043b\u043e \u0438\u043b\u0438 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438, \u043f\u0438\u0448\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b, \u043e\u0431\u0441\u0443\u0434\u0438\u043c. \u0423\u0434\u0430\u0447\u0438 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/918546\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u041e \u043a\u0430\u043a\u043e\u043c \u043e\u043f\u044b\u0442\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u0430\u043c\u0438: \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438, \u0433\u0434\u0435 \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 (API\/UX)<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f?<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 utils, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043c \u0434\u0435\u0440\u0436\u0430\u0442\u044c?<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435\u0442. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/918546\/\"> https:\/\/habr.com\/ru\/articles\/918546\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h3>\u041a\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442\u044b \u2014 \u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u043f\u0440\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0438 \u0438 \u043a\u043e\u0434\u0435\u0440\u044b! \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c: \u043f\u0438\u0448\u0435\u0448\u044c \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f UX, \u0432\u0441\u0451 \u043a\u0440\u0430\u0441\u0438\u0432\u043e, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u2014 \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0441 \u043d\u0443\u043b\u044f: \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043d\u043e\u043f\u043a\u0430. \u041a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0443 \u0442\u0435\u0441\u0442\u043e\u0432 \u0430\u043c\u043d\u0435\u0437\u0438\u044f! \u042d\u0442\u043e \u0431\u0435\u0441\u0438\u0442, \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u0434 \u0432 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0443. \u0414\u0430\u0432\u0430\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u043a\u0430\u043a \u0432\u044b\u043a\u0438\u043d\u0443\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u043b\u043e\u0433\u0438\u043d \u043d\u0430 \u0441\u0432\u0430\u043b\u043a\u0443 \u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0432\u0441\u0451 \u0441 Playwright \u0438 Python.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0437\u043b\u043e<\/h3>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u043d\u0430\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u0442\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u0432\u0445\u043e\u0434\u044f \u0432 \u0434\u043e\u043c, \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u0441\u0432\u043e\u0435\u0439 \u0441\u043e\u0431\u0430\u043a\u0435. \u0412\u043e\u0442 \u0447\u0442\u043e \u0431\u0435\u0441\u0438\u0442:<\/p>\n<ul>\n<li>\n<p><strong>\u0422\u043e\u0440\u043c\u043e\u0437\u0430<\/strong>: \u041a\u0430\u0436\u0434\u044b\u0439 \u043b\u043e\u0433\u0438\u043d \u2014 \u044d\u0442\u043e + ~5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043a \u0442\u0435\u0441\u0442\u0443. \u0423\u043c\u043d\u043e\u0436\u044c \u043d\u0430 100 \u0442\u0435\u0441\u0442\u043e\u0432, \u0438 \u0442\u044b \u0443\u0436\u0435 \u0432\u0430\u0440\u0438\u0448\u044c \u043a\u043e\u0444\u0435, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0437\u0443\u0442.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u0434 \u2014 \u043f\u043e\u043c\u043e\u0439\u043a\u0430<\/strong>: \u041f\u0438\u0445\u0430\u0442\u044c \u0448\u0430\u0433\u0438 \u043b\u043e\u0433\u0438\u043d\u0430 \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u2014 \u044d\u0442\u043e \u043a\u0430\u043a \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u00abHello, World!\u00bb \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b. \u041d\u0443 \u0442\u0430\u043a\u043e\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u0436\u0438\u0442\u044c \u0442\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f. \u0418 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c. Playwright \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0433\u0438\u0438 Python \u043d\u0430\u043c \u0432 \u043f\u043e\u043c\u043e\u0449\u044c.<\/p>\n<h3>\u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0432\u0441\u0435\u0445<\/h3>\n<p>\u0412 Playwright \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u0430\u043a \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430. \u042d\u0442\u043e \u0442\u0438\u043f\u0430 \u0442\u0432\u043e\u044f \u0441\u0435\u0441\u0441\u0438\u044f, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043a\u0443\u043a\u0438, localStorage \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u0432\u043a\u0443\u0441\u043d\u043e\u0441\u0442\u0438. \u0418\u0434\u0435\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u2014 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0432 \u043e\u0431\u0449\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u0430\u0441\u0442\u0438\u0441\u044c \u0432 \u043d\u0451\u043c, \u043a\u0430\u043a \u0432 \u043e\u0431\u0449\u0435\u043c \u043f\u0430\u0441\u0442\u0431\u0438\u0449\u0435. \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0445 \u043b\u043e\u0433\u0438\u043d\u043e\u0432, \u0432\u0441\u0451 \u043b\u0435\u0442\u0430\u0435\u0442, \u0432\u0441\u0435 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u044b.<\/p>\n<p>\u041d\u043e \u043c\u044b \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438: \u0435\u0441\u043b\u0438 \u0442\u0435\u0441\u0442\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u0431\u0435\u0440\u0451\u043c \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u043d\u043e\u0432\u044b\u0439. \u0410 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u0437\u0430\u043c\u0443\u0442\u0438\u043c \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @use_session, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c: \u00ab\u042d\u0439, \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0445\u043e\u0447\u0435\u0442 \u0432 \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u0442\u0451\u043b!\u00bb \u041f\u043e\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u0434.<\/p>\n<h3>\u041a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c: \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b \u0438 \u043a\u043e\u0434<\/h3>\n<h4>\u0428\u0430\u0433 1: \u0424\u0438\u043a\u0441\u0442\u0443\u0440\u044b \u2014 \u043d\u0430\u0448\u0435 \u0432\u0441\u0451<\/h4>\n<p>\u0412 conftest.py \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043a\u0430\u043a \u0448\u0432\u0435\u0439\u0446\u0430\u0440\u0441\u043a\u0438\u0435 \u0447\u0430\u0441\u044b. \u0427\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u041e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/strong>: \u041e\u0434\u0438\u043d \u043d\u0430 \u0432\u0441\u044e \u0441\u0435\u0441\u0441\u0438\u044e, \u0441 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p><strong>\u041d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/strong>: \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u043e\u0432, \u0433\u0434\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441\u0442\u0443\u0440\u0430 page<\/strong>: \u0423\u043c\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0430\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0434\u0441\u0443\u043d\u0443\u0442\u044c, \u0433\u043b\u044f\u0434\u044f \u043d\u0430 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440.<\/p>\n<\/li>\n<li>\n<p><strong>\u0424\u0438\u043a\u0441\u0442\u0443\u0440\u0430 <\/strong>authorize<strong>:<\/strong> \u041b\u043e\u0433\u0438\u043d\u0438\u0442\u0441\u044f \u0440\u0430\u0437 \u0438 \u0432\u0441\u0451.<\/p>\n<\/li>\n<\/ul>\n<h4>\u0428\u0430\u0433 2: \u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440 @use_session<\/h4>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u043c\u0435\u0442\u043a\u0430 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0435\u0441\u0442\u043e\u0432 \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u0435\u0441\u0442\u044c \u2014 \u0442\u0435\u0441\u0442 \u0431\u0435\u0436\u0438\u0442 \u0432 \u043e\u0431\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0432 \u043d\u043e\u0432\u044b\u0439. \u0412\u0441\u0451, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0445 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439.<\/p>\n<h4>\u0428\u0430\u0433 3: \u041f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u044b<\/h4>\n<p>\u0421\u0442\u0430\u0432\u0438\u0448\u044c @use_session \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\/\u0442\u0435\u0441\u0442 \u2014 \u0438 \u0442\u0435\u0441\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u0431\u0449\u0443\u044e \u0441\u0435\u0441\u0441\u0438\u044e. \u041d\u0435 \u0441\u0442\u0430\u0432\u0438\u0448\u044c \u2014 \u0442\u0435\u0441\u0442 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0451\u043c \u043f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u0438 \u043a\u0440\u0430\u0441\u0438\u0432\u043e.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 conftest.py<\/h3>\n<pre><code class=\"python\">import allure import pytest from playwright.sync_api import sync_playwright  from src.pages.auth_page import AuthPage from src.pages.landing_page import LandingPage  def use_session(cls):     cls.use_session = True     return cls  @pytest.fixture(scope=\"session\") def playwright():     with sync_playwright() as p:         yield p  @pytest.fixture(scope=\"session\") def browser(playwright):     browser = playwright.chromium.launch(headless=True)     yield browser     browser.close()  @pytest.fixture(scope=\"session\") def shared_context(browser, authorize):     context = browser.new_context()     yield context     context.close()  @pytest.fixture(scope=\"function\") def new_context(browser):     context = browser.new_context()     yield context     context.close()  @pytest.fixture(scope=\"function\") def page(request, new_context, shared_context, domain):     context = shared_context if hasattr(request.cls, \"use_session\") else new_context     page = context.new_page()     page.goto(domain, wait_until=\"load\", timeout=3000)     yield page     page.close()  @pytest.fixture(scope=\"session\", autouse=True) def authorize(shared_context, domain):     page = shared_context.new_page()     page.goto(domain, wait_until=\"load\", timeout=3000)          with allure.step(\"\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430\"):         landing = LandingPage(page, domain)         landing.open()         landing.click_login_button()                  auth = AuthPage(page, domain)         auth.fill_login(\"testuser@example.com\")         auth.fill_password(\"supersecret\")         auth.click_submit()          page.close()<\/code><\/pre>\n<h4>\u0427\u0442\u043e \u0442\u0443\u0442 \u0442\u0432\u043e\u0440\u0438\u0442\u0441\u044f:<\/h4>\n<ul>\n<li>\n<p><strong>shared_context<\/strong>: \u0416\u0438\u0432\u0451\u0442 \u0432\u0441\u044e \u0441\u0435\u0441\u0441\u0438\u044e, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043d\u0451\u043c \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p><strong>new_context<\/strong>: \u041d\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430, \u0435\u0441\u043b\u0438 \u043e\u0431\u0449\u0438\u0439 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><strong>page<\/strong>: \u0421\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 \u0442\u0435\u0441\u0442\u0430 \u0438 \u0440\u0435\u0448\u0430\u0435\u0442, \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0431\u0440\u0430\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p><strong>authorize<\/strong>: \u0417\u0430\u043b\u043e\u0433\u0438\u043d\u0438\u043b\u0438\u0441\u044c \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u2014 \u0438 \u0432\u0441\u0451, \u043c\u043e\u0436\u043d\u043e \u043a\u0443\u0440\u0438\u0442\u044c \u0431\u0430\u043c\u0431\u0443\u043a.<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 test.py<\/h3>\n<p>\u0412\u043e\u0442 \u0442\u0435\u0431\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0435\u0441\u0442\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043a\u043e\u0442\u0438\u043a\u0430\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"python\">import allure import pytest from conftest import use_session from src.pages.cat_page import CatPage  @use_session class TestCatPage:     @allure.title(\"\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0442\u0438\u043a\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435\")     def test_check_cats(self, page, domain):         cats = CatPage(page, domain)         cats.open()         assert cats.count_cats() &gt; 0, \"\u0413\u0434\u0435 \u043a\u043e\u0442\u0438\u043a\u0438? \u042f \u0442\u0440\u0435\u0431\u0443\u044e \u043a\u043e\u0442\u0438\u043a\u043e\u0432!\"<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u0442\u0438\u043a\u0438 \u043d\u0430 \u043c\u0435\u0441\u0442\u0435. \u041b\u043e\u0433\u0438\u043d? \u041a\u0430\u043a\u043e\u0439 \u043b\u043e\u0433\u0438\u043d? \u041e\u043d \u0443\u0436\u0435 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c!<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e:<\/h3>\n<ul>\n<li>\n<p><strong>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c<\/strong>: \u0422\u0435\u0441\u0442\u044b \u0431\u0435\u0433\u0443\u0442, \u043a\u0430\u043a \u0441\u043f\u0440\u0438\u043d\u0442\u0435\u0440\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0438\u0431\u043a\u043e\u0441\u0442\u044c<\/strong>: \u0425\u043e\u0447\u0435\u0448\u044c \u0441 \u043b\u043e\u0433\u0438\u043d\u043e\u043c, \u0445\u043e\u0447\u0435\u0448\u044c \u0431\u0435\u0437 \u2014 \u0432\u0441\u0451 \u043f\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>\u041a\u043e\u0434 \u0447\u0438\u0441\u0442\u044b\u0439<\/strong>: \u041d\u0438\u043a\u0430\u043a\u0438\u0445 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u043e\u0432 \u0441 \u0448\u0430\u0433\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451. \u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0432\u043e\u0438 \u0442\u0435\u0441\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0432\u0435\u0447\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u043d\u044b. Playwright, Python \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u0438 \u2014 \u044d\u0442\u043e \u0432\u0441\u0451 \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c. \u0415\u0441\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0437\u0430\u0448\u043b\u043e \u0438\u043b\u0438 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438, \u043f\u0438\u0448\u0438 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u044b, \u043e\u0431\u0441\u0443\u0434\u0438\u043c. \u0423\u0434\u0430\u0447\u0438 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/918546\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u041e \u043a\u0430\u043a\u043e\u043c \u043e\u043f\u044b\u0442\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u0430\u0432\u0442\u043e\u0442\u0435\u0441\u0442\u0430\u043c\u0438: \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0430\u043f\u043a\u0438, \u0433\u0434\u0435 \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 (API\/UX)<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f?<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 utils, \u0447\u0442\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043c \u0434\u0435\u0440\u0436\u0430\u0442\u044c?<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0421\u0432\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041d\u0438\u043a\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043d\u0435\u0442. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/918546\/\"> https:\/\/habr.com\/ru\/articles\/918546\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-463479","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463479"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463479\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}