0

i do not need to open new page in chrome, I have to use the same existing page

I am trying to send WhatsApp messages using Python from the web, but every time it opens a new page and downloads WhatsApp Web again. I need help

def sendwhatmsg_instantly(phone_no: str, message: str, wait_time: int = 20) -> None: """Send WhatsApp Message Instantly""" parsed_message = quote(message)

web.open(f"https://web.whatsapp.com/send?phone={phone_no}&text={quote(message)}")
time.sleep(wait_time)
pg.press('enter')
5
  • 1
    what have you tried so far ? the question needs sufficient code for a minimal reproducible example Commented Feb 11, 2024 at 18:02
  • 1
    Are you using pywhatkit? I agree with @D.L, please make your question clearer. Commented Feb 11, 2024 at 20:05
  • Python has no idea what "the existing page" is though: you could have 100 tabs open, how would it know which one to replace? If you mean "make the page I am working with navigate to a new URL" then inject an <a href="..."> into the page and have the code make the page "click" that. Commented Feb 13, 2024 at 17:42
  • I am using webbrowser function web.open(f"web.whatsapp.com/send?phone={phone_no}&text={quote(message)}") Commented Feb 13, 2024 at 17:42
  • Is there other solutions rather than webbrowser Commented Feb 13, 2024 at 17:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.