DJIGIT95
New member
I am also doing csv automation(fill up forms on the web)trying to use random proxies from a .txt file using selenium python. What I want to do is it the code uses random proxies from my .txt file every time the webdriver opens and fills up the forms. My code is all working and stuffs but my only problem is the proxies are not being used and it only uses my local IP.
Here is the code. Hope you can help me. TIA btw, I am using proxies from a private proxy provider and they are all working too. here is the proxy format. f.eks pr.privatecompany.co.ukort:customer-username-cc-be:UNIQUECODE
I am not sure if it's correct.
Here is the code. Hope you can help me. TIA btw, I am using proxies from a private proxy provider and they are all working too. here is the proxy format. f.eks pr.privatecompany.co.ukort:customer-username-cc-be:UNIQUECODE
Code:
import requests
import time
import random
from time import sleep
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.common.proxy import Proxy, ProxyType
#-------------------------------------------------------------------------------
# Setup
api_key = '' # Your 2captcha API KEY
site_key = ''
PROXY = "pr.privatecompany.co.uk:port:customer-username-cc-be:UNIQUECODE"
proxy.proxy_type = ProxyType.MANUAL
proxy.http_proxy = proxy_ip_port
proxy.ssl_proxy = proxy_ip_port
capabilities = webdriver.DesiredCapabilities.CHROME['PROXY']
proxy.add_to_capabilities(capabilities)
driver = webdriver.Chrome('your_absolute_path', desired_capabilities=capabilities)
driver.get('http://whatismyipaddress.com')
phone = 0
email = 1
firstname = 2
lastname = 3
with open('data.csv', 'r') as csv_file:
csv_reader = csv.reader(csv_file)```
I am not sure if it's correct.