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

[BUG] (Action) Selectors do not Work after Manual Content Setting #7

Open
1 task done
Vinyzu opened this issue Dec 11, 2023 · 4 comments
Open
1 task done

[BUG] (Action) Selectors do not Work after Manual Content Setting #7

Vinyzu opened this issue Dec 11, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@Vinyzu
Copy link

Vinyzu commented Dec 11, 2023

Source code

  • I provided exact source code that allows reproducing the issue locally.

Test file (self-contained)

import asyncio

# undetected-playwright here!
from playwright.async_api import async_playwright, Playwright

async def run(playwright: Playwright):
    args = []

    # disable navigator.webdriver:true flag
    args.append("--disable-blink-features=AutomationControlled")
    browser = await playwright.chromium.launch(headless=False,
                                               args=args)

    context = await browser.new_context()
    page = await context.new_page()
    await page.goto("https://raw.githack.com/microsoft/playwright-python/main/tests/assets/empty.html")
    await page.set_content('<a href="https://raw.githack.com/microsoft/playwright-python/main/tests/assets/one-style.html">yo</a>')
    await page.click("a")
    await page.wait_for_timeout(10000)

async def main():
    async with async_playwright() as playwright:
        await run(playwright)


if __name__ == "__main__":
    loop = asyncio.ProactorEventLoop()
    loop.run_until_complete(main())

Expected

The Selector should be able to pick up the new inserted content, like it is the case with "normal" playwright.

Actual

The Selector doesnt pick up the new content.
Note: Could be explained by a missing isolatedContext consideration.

@Vinyzu
Copy link
Author

Vinyzu commented Dec 11, 2023

Note:

await page.locator("a").click()

Works as expected.

@Vinyzu
Copy link
Author

Vinyzu commented Dec 13, 2023

Note no.1:

await page.set_content('<iframe src="demo_iframe.htm" height="200" width="300" title="Iframe Example"></iframe> ')
print(page.frame_locator('[title="Iframe Example"]'))

Also doesnt work. Other Functions including Selectors maight also not be expected to work

@kaliiiiiiiiii kaliiiiiiiiii added the bug Something isn't working label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants