3

i am trying to make an automation project which will use proxy to register in a site. but i am unable to get it work.

I have tried selenium-wire for proxy authentication still it doesn't work

from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.firefox.options import Options
import os
import keyboard
import pyautogui
from time import sleep


user = 'jesbeqki'
pwd = '1wbt8dnqtu8w'
end = '2.56.119.93:5074'

seleniumwire_options ={
    "proxies" : {
    "https": "http://"f"{user}:{pwd}@{end}/",
    "http": "http://"f"{user}:{pwd}@{end}/",
    'verify_ssl': False
}
}
firefox_options = Options()
# firefox_options.add_argument("--headless")
driver = webdriver.Firefox(options=firefox_options, seleniumwire_options=seleniumwire_options)

driver.get('https://httpbin.org/ip')

text = driver.find_element(By.TAG_NAME, 'body').text
print(text)

it's showing my original ip.

2 Answers 2

3

You can use SeleniumBase to proxy to a site.

pip install seleniumbase, then run this with python after filling in the proxy details:

from seleniumbase import SB

with SB(uc=True, proxy="USER:PASS@IP:PORT") as sb:
    sb.driver.get("https://whatismyip.com")
    sb.sleep(5)
Sign up to request clarification or add additional context in comments.

5 Comments

what if i dont have a user or pass only ip and port bec its public? it doesnt work when i do ip:port any site says {domain} did not respond smth like that
proxy="IP:PORT" format should work as long as your proxy is valid.
the ip and port work for requests and ipinfo but when i use SB it always says example.com took too long to respond
You are using an unsupported command-line flag: --ignore-certificate-errors. Stability and security will suffer. Site couldnt be reached whatismyip.com took too long to respond. python from seleniumbase import SB with SB(uc=True, proxy="IP:PORT") as sb: sb.sleep(10) sb.driver.get("https://whatismyip.com") sb.sleep(10)
but this works: python import requests proxies = {"http": "http://IP:PORT"} response = requests.get("http://ipinfo.io/json", proxies=proxies) print(response.json())
0

you can try to add the proxy config like this:

options.add_argument(f'--proxy-server={proxy["ip"]}:{proxy["port"]}')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.