- Joined
- Feb 20, 2023
- Messages
- 1
- Reaction score
- 0
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
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")
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")