#๐Ÿ”’ Open href link in a new tab [nodriver]

21 messages ยท Page 1 of 1 (latest)

lucid wren
#

Hey, so I was able to extract the href of a button and im basically trying to open that link in a new tab. Im new to nodriver and cant really find anything where you can open the button in a new tab. I have this down right now, if someone could point me in the right direction, it would be really helpful

    try:
        tab = await browser.get("https://www.hm.com")
        await asyncio.sleep(3)

        sign_up_button = await tab.find("//a[@class='styles__ButtonRoot-sc-1ldytso-0 bzOPhu']")
        print(f"Sign Up Button: {sign_up_button}")

        # Open the sign-up URL in a new tab
        sign_up_url = await tab.evaluate("el => el.href", sign_up_button) #it's wrong ๐Ÿ˜ญ
        print(f"Sign Up URL: {sign_up_url}")

        # Open the sign-up URL in a new tab
        signup_tab = await browser.get(sign_up_url)
        await asyncio.sleep(5)
winter depotBOT
#

@lucid wren

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lucid wren
#

the print of "Sign Up Button:" is displayed, shows the entire html for the button, including the href, but for some reason the bot stops there and cant grab the href and open it. Keep getting 'NoneType' object is not callable

unreal lava
#

we can't help with that here

#

!rule 5

winter depotBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

lucid wren
#

there is nothing on their tos for creating an acc

#

how am I violating?

unreal lava
#

read the terms of service properly

#
Prohibited Uses of Site
You understand and agree not to (i) post, transmit, redistribute, upload, or promote any communications or content that could harm or negatively impact our business, products or services; (ii) act in a manner or employ any device that restricts, impairs, interferes or inhibits any other user from using or enjoying the Site, or which impacts the security of the Site, or (iii) employ any device or attempt to use any engine, software, tool, agent or other device or mechanism (including without limitation spiders, bots, crawlers, avatars or intelligent agents) to navigate or search the Site, or to copy content from the Site.
lucid wren
#

Im not web scraping

#

Its just acc creation

unreal lava
#

thats literally a bot

lucid wren
#

I know, but that seems to be referring to web scraping

unreal lava
#

its even worse than web scraping

unreal lava
lucid wren
#

Alright

sleek thunder
winter depotBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.