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

[nodriver] Find an element in an element #1946

Open
Allamaris0 opened this issue Jul 13, 2024 · 0 comments
Open

[nodriver] Find an element in an element #1946

Allamaris0 opened this issue Jul 13, 2024 · 0 comments

Comments

@Allamaris0
Copy link

Allamaris0 commented Jul 13, 2024

Thx for nodriver. I really appreciate the project. I have such code:

<div class="Home_editor__DEHWl"><h1 class="Home_editor__header__uckv3">Some header</h1>
    <h2 class="Home_editor__subheader__VkFTs">Some header 2</h2>
    <p class="Home_editor__description__B_ijd">Some paragraph</p>
    <textarea class="Home_editor__textarea__W6jTe" placeholder="Enter text here"></textarea>
    <div class="Home_editor__button_row__kH0rZ">
        <button class="Home_editor__button__iu08P">Some button</button>
    </div>
</div>

How to find "textarea" inside this div? I got an error when I try use "find"

    h_element = await page.find("Some header",  best_match=True)
    parent_element = h_element.parent
    print(parent_element)

    textarea = await parent_element.find("textarea")
    await textarea.send_keys(text)

Traceback:

Traceback (most recent call last):
  File "C:\Users\Emilia\PycharmProjects\no-driver-project\testing-nodriver.py", line 57, in <module>
    uc.loop().run_until_complete(main())
  File "C:\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File  "C:\Users\Emilia\PycharmProjects\no-driver-project\testing-nodriver.py", line 23, in main
    textarea = await parent_element.find("textarea")
TypeError: 'NoneType' object is not callable
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

No branches or pull requests

1 participant