HarshCasper / HarshCasper/Rotten-Scripts
Fatal SyntaxError on Launch, Hardcoded User Path, and Deprecated Selenium Locators in WhatsApp Message Automation
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues.
### Current Behavior
#### 1. Current Behavior
When attempting to run `Python/WhatsApp_Message_Automation/whatsapp_message_automation.py`, the script fails to execute immediately due to three primary issues:
1. **Fatal SyntaxError on Launch (Line 10):**
The variable name `twenty-five` uses a hyphen (`-`). In Python syntax, `-` is treated as a subtraction operator rather than a valid identifier character. The interpreter crashes during the AST parsing phase before executing any code:
```text
File "Python/WhatsApp_Message_Automation/whatsapp_message_automation.py", line 10
twenty-five = 25
^^^^^^^^^^^
SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?
### Expected Behavior
**Expected Behavior**
- The script should compile and execute cleanly without any syntax errors across all supported Python 3.x versions.
- ChromeDriver initialization should be dynamic and portable (leveraging system PATH, webdriver-manager, or dynamic CLI/argument options) without hardcoding private user file paths.
- Element locators should use standard, modern Selenium 4 driver.find_element(By.XPATH, ...) syntax.
- The script should provide clear console prompts and structured error handling for WhatsApp Web QR authentication and chat interactions.
### To Reproduce
### 3. To Reproduce
#### A. Environment Setup & Prerequisites
Ensure Python 3.8+ and standard dependencies are installed on the testing environment:
```bash
# Clone the repository
git clone https://github.com/HarshCasper/Rotten-Scripts.git
cd Rotten-Scripts/Python/WhatsApp_Message_Automation
# Install required Selenium package
pip install selenium
### Anything else?
- Operating System: Cross-platform (Windows / macOS / Linux)
- Python Version Tested: Python 3.8 / 3.9 / 3.10 / 3.11 / 3.12
- Selenium Version: Selenium 4.x+
- Impact: Fixing this makes the script fully functional, cross-platform compatible, and ready for modern Python/Selenium environments.
- Contribution: I have already analyzed and tested the fix locally. Could you please assign this issue to me so I can submit a clean, well-tested Pull Request?
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Research direction
Start with Python/WhatsApp_Message_Automation/whatsapp_message_automation.py and run it under a supported Python 3 version to reproduce the syntax error at line 10. Inspect the ChromeDriver setup and Selenium locator calls named in the issue. Done means the script compiles, avoids private user paths, uses Selenium 4 locator syntax, and provides the requested prompts and error handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100