I want to code whatsapp phone number validator. The script will take input phone numbers list from user and will check over whatsapp if its registered or not

I want to code python script. The script will take input phone numbers list from user and then it will check over whatsapp using selenium if its registered on whatsapp or not. The script will be able to check each and every number from the list if its registered it will display registered if its not it will display not registered .
Please check my code but its not working perfect:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

Initialize the webdriver for Firefox

driver = webdriver.Firefox()

Open the WhatsApp Web interface

driver.get(“https://web.whatsapp.com/”)

Wait for the user to scan the QR code and log in

input(“Press Enter after scanning the QR code and logging in…”)

Open the file containing the phone numbers

with open(“phone.txt”, “r”) as f:
for line in f:
# Strip any whitespace from the line
line = line.strip()
# Navigate to the WhatsApp Web search page
driver.get(f"WhatsApp Web“)
time.sleep(10) # wait for the page to load
# Check if the phone number is registered on WhatsApp
if driver.find_elements_by_xpath(”//button[contains(text(), ‘Send message’)]“):
print(f”{line} - Registered on WhatsApp")
else:
print(f"{line} - Not registered on WhatsApp")

Close the webdriver

driver.quit()

Please format your code correctly:

What does that mean? Is it giving an error? Is it just not doing what you want? Don’t expect us to guess what “not working perfect” means to you, tell us what it is doing wrong.

What do you expect the code to do? What is it doing instead?

If there is an error, copy and paste the error and format it as code, the same as above. Don’t post a screen shot or a photo.