Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix playwright.dev generation error #5360

Merged
merged 2 commits into from Feb 8, 2021
Merged

Conversation

yury-s
Copy link
Member

@yury-s yury-s commented Feb 8, 2021

Fixes following error:

  type: 'code',
  lines: [
    'import asyncio',
    'from playwright.async_api import async_playwright',
    '',
    'async def main():',
    '    async with async_playwright() as p:',
    '        # Make sure to run headed.',
    '        browser = await p.chromium.launch(headless=False)',
    '',
    '        # Setup context however you like.',
    '        context = await browser.new_context() # Pass any options',
    "        await context.route('**/*', lambda route: route.continue_())",
    '',
    '        # Pause the page, and start recording manually.',
    '        page = await context.new_page()',
    '        await page.pause()',
    '',
    'asyncio.run(main())'
  ],
  codeLang: 'python async'
}
/home/yurys/playwright.dev/src/generator.js:169
            throw new Error('Bad Python snippet pair');
            ^

Error: Bad Python snippet pair
    at Generator.formatComment (/home/yurys/playwright.dev/src/generator.js:169:19)
    at /home/yurys/playwright.dev/src/generator.js:245:30
    at visit (/home/yurys/playwright.dev/src/markdown.js:364:3)
    at visit (/home/yurys/playwright.dev/src/markdown.js:366:5)
    at Object.visitAll (/home/yurys/playwright.dev/src/markdown.js:356:5)
    at Generator.generateDoc (/home/yurys/playwright.dev/src/generator.js:243:8)
    at new Generator (/home/yurys/playwright.dev/src/generator.js:83:12)
    at Object.<anonymous> (/home/yurys/playwright.dev/src/generator.js:448:1)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)

@yury-s yury-s merged commit 4bfdaa3 into microsoft:master Feb 8, 2021
@yury-s yury-s deleted the docs-gen branch February 8, 2021 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants