Skip to main content

This guide will help you integrate the Geonode API with Selenium to manage proxies effectively while running headless browsers. We will be using Python for this guide.

Prerequisites: Get Proxy Credentials from Geonode

Before setting up a proxy, first, retrieve your proxy credentials from the Geonode dashboard.

Prerequisites

  • Python installed on your system
  • Geonode API credentials (username and password)
  • ChromeDriver installed (compatible with your Chrome version)

Steps: Setting Up a Proxy in Brave

Follow these steps to configure a proxy in Selenium:

Step 1: Set Up a Virtual Environment

Creating a virtual environment helps isolate dependencies and avoid conflicts.

Step 2: Install Required Libraries

  • Selenium: For browser automation
  • python-dotenv: For managing environment variables
  • selenium-wire: To handle proxy authentication, as Selenium doesn’t provide it natively

Step 3: Configure Geonode Proxy Endpoint

With the help of the Endpoint Generator, you can easily generate the proxy with specific configurations such as:
  • Target country
  • Port
  • Session persistence
  • And many more
endpoint generator Refer to the guide How to Use the Endpoint Generator to generate your endpoints.

Step 4: Setting up environment variables

  1. Create a .env file in your project directory.
  2. Add your credentials:
Never upload your .env file to the internet.

Code Implementation

I. Import

ii. Load environment variables

iii. Configure Proxy options

iv. Configure Browser Options

v. Initialize Browser

vi. Open IP address website to check

Output: selenium-ip-address

vii. Keep the browser open

viii. Quit the browser

xi. Full Code

x. Folder Stucture

Source Code

You can find the full source code for this script on GitHub at the following link: https://github.com/geonodecom/proxy-testing-toolkit/tree/automation-framework/selenium

Use Cases of Integrating Geonode with Selenium

Integrating Geonode with Selenium can be beneficial for a wide range of applications, including:
  1. Web Scraping: Collect data from websites while maintaining anonymity to avoid IP bans.
  2. Ad Verification: Test and verify advertisements across different geographies to ensure proper delivery.
  3. Price Monitoring: Track pricing changes on e-commerce platforms without getting blocked.
  4. SEO Monitoring: Monitor search engine results and competitor websites without affecting personalized search results.
  5. Market Research: Gather data from various sources to analyze trends and competitor performance.
  6. Social Media Automation: Manage multiple social media accounts while avoiding detection.
  7. Fraud Detection: Simulate real-world traffic for security testing and fraud detection systems.
Explore more use cases here https://geonode.com/use-cases

Troubleshooting Tips

  • Timeout Errors: Check if the proxy is active or switch to another proxy.
  • Authentication Issues: Double-check your Geonode API credentials.
  • Incompatible ChromeDriver: Ensure ChromeDriver matches your Chrome version.
If you encounter any issues, refer to the troubleshooting section or Geonode support.

FAQs

The authentication details are embedded in the proxy URL, so no pop-up should appear.
Yes, but you need to adjust the proxy settings using Firefox profiles.
Verify the proxy server details and ensure Geonode proxies are correctly configured.