How to configure proxy settings for selenium webdrive with python?

Submitted 3 years, 4 months ago
Ticket #311
Views 313
Language/Framework Python
Priority Low
Status Closed

Facing problem , when tried  to run test scripts against external websites.

I am trying to automate  both internal and external webpages/applications with selenium webdriver binding with Python using a docker container. . 

Submitted on Nov 30, 20
add a comment

1 Answer

Verified

You can set up an unauthenticated proxy server in Selenium in just five steps:

from selenium import webdriver

PROXY = "12.345.678.910:8080"

chrome_options = WebDriverWait.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)

chrome = webdriver.Chrome(chrome_options=chrome_options)
chrome.get("https://www.google.com")
  1. Import WebDriver from the Selenium package.
  2. Define the proxy server (IP:PORT or HOST:PORT).
  3. Set ChromeOptions() to a variable.
  4. Add the proxy server argument to the options.
  5. Add the options to the Chrome() instance.

Submitted 3 years, 4 months ago


Latest Blogs