Thordata Docs
English
English
  • Overview
  • PROXIES
    • Integration Tutorial
      • Residential Proxies Integration
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Playwright
        • Puppeteer
        • Selenium
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
        • MuLogin
      • ISP Proxies Integration
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
      • Datacenter Proxies Integration
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
      • Unlimited Proxies Integration
        • AdsPower
        • BitBrowser
        • ClonBrowser
        • Ghost Browser
        • SwitchyOmega
        • FoxyProxy
        • Chrome
        • Edge
    • Residential Proxies
      • Getting Started Guide
      • Endpoint Generator
        • User & Pass auth
        • Whitelisted IPs
          • Country Entry
            • Country/Region Entry Node
          • API Link
      • Users
      • Basic Query
      • location Settings
        • Country / Region
        • City
        • State
      • Session Control
      • Protocols
      • Country/Region list
      • CDKEY Generation and Redemption
    • ISP Proxies
      • Getting Started Guide
    • Datacenter Proxies
      • Getting Started Guide
    • Unlimited Proxy Servers
      • Endpoint Generator
        • User & Pass auth
        • Whitelisted IPs
          • Country Entry
          • API Link
      • Users
      • Country/Region list
  • Scraping
    • SERP API
      • Quick Start Guide
      • Configuration
      • API Playground
      • SSL Certificate
      • Send Your First Request
      • Parsed JSON Result
      • SERP API Google Query Parameters
      • SERP API Bing Query Parameters
    • WEB Scraper API
      • Getting Started Guide
      • API request builder
  • FREE TOOLS
    • Chrome Extension
      • Tutorial
  • USEFUL LINKS
    • Dashboard Center
  • FAQ
    • Product Problem
      • How do I choose the right proxy package?
      • How to target specific countries/regions?
      • How to target a specific city?
      • What is Unlimited Proxies?
      • The IP test result does not match the region where the extraction was purchased?
    • Payment Problem
      • What payment methods are supported?
      • What should I do if I buy the wrong package?
      • Do you provide refunds for paid services?
      • After payment, how long does it take to receive my agency balance or activate my account?
  • SUPPORT
    • Contact Us
Powered by GitBook
On this page

Was this helpful?

Last updated 3 months ago

Was this helpful?

What is Selenium?

is an umbrella project for a range of tools and libraries that enable and support the automation of web browsers.

Selenium is many things but at its core, it is a toolset for web browser automation that uses the best techniques available to remotely control browser instances and emulate a user’s interaction with the browser.

Here's how to integrate Thordata with Selenium.

1

Install Selenium

Another recommended package for this integration is webdriver-manager. It's a package that simplifies the management of binary drivers for different browsers. In this case, there's no need to manually download a new version of a web driver after each update.

You can install the webdriver-manager using the pip command as well: pip install webdriver-manager

2

Specify your user credentials for proxies to work

USERNAME = "td-customer-USERNAME"

PASSWORD = "PASSWORD"

ENDPOINT = "t.pr.thordata.net:9999"

3

Check proxy status

Check if the proxy is working by visiting ipinfo.thordata.com. If everything is working correctly - it will return an IP address of a proxy you're using.

Full Code Example:

Install to extend Selenium's Python bindings because using the default Selenium module for implementing proxies that require authentication makes the whole process complicated. You can do it using the pip command: pip install selenium-wire

try:
    driver.get("https://ipinfo.thordata.com/")
    return f'\nYour IP is: {driver.find_element(By.CSS_SELECTOR, "pre").text}'
finally:
    driver.quit()
from selenium.webdriver.common.by import By
from seleniumwire import webdriver
# A package to have a chromedriver always up-to-date.
from webdriver_manager.chrome import ChromeDriverManager

USERNAME = "td-customer-USERNAME"
PASSWORD = "PASSWORD"
ENDPOINT = "t.pr.thordata.net:9999"

def chrome_proxy(user: str, password: str, endpoint: str) -> dict:
    wire_options = {
        "proxy": {
            "http": f"http://{user}:{password}@{endpoint}",
            "https": f"https://{user}:{password}@{endpoint}",
        }
    }

    return wire_options

def execute_driver():
    options = webdriver.ChromeOptions()
    options.add_argument('--headless')
    proxies = chrome_proxy(USERNAME, PASSWORD, ENDPOINT)
    driver = webdriver.Chrome(
    ChromeDriverManager(driver_version='<VERSION>').install(), options=options, seleniumwire_options=proxies
    )
    try:
        driver.get("https://ipinfo.thordata.com/")
        return f'\nYour IP is: {driver.find_element(By.CSS_SELECTOR, "pre").text}'
    finally:
        driver.quit()


if __name__ == '__main__':
    print(execute_driver())
  1. PROXIES
  2. Integration Tutorial
  3. Residential Proxies Integration

Selenium

PreviousPuppeteerNextGhost Browser
Selenium Wire
Selenium