Skip to content

Fatal SyntaxError on Launch, Hardcoded User Path, and Deprecated Selenium Locators in WhatsApp Message Automation #1452

Description

@codeCraft-Ritik

Is there an existing issue for this?

  • 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:
      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:

# 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions