- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I manually set proxy settings in Python Selenium?
We can manually set proxy settings using Selenium webdriver in Python. It is done using the DesiredCapabilities class. We would create an object of this class and apply the add_to_capabilities method to it. Then pass the proxy capabilities as a parameter to this method.
Example
Code Implementation
from selenium import webdriver from selenium.webdriver.common.proxy import ProxoxyType #add proxy’s ip and port p = '<proxy ip, port>' pxy = Proxy() #set proxy type pxy.p_type = ProxyType.MANUAL #http proxy pxy.http_pxy = p #ssl proxy pxy.ssl_pxy = p #object of DesiredCapabilities c = webdriver.DesiredCapabilities.CHROME #set proxy browser capabilties pxy.add_to_capabilities(c) #set chromedriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe", desired_capabilities = c) #launch URL driver.get("https://www.tutorialspoint.com/index.htm") #quit browser driver.quit()
- Related Articles
- How to set Proxy in Firefox using Selenium WebDriver?
- Running Selenium Webdriver with a proxy in Python.
- How can I trigger an onchange event manually in javascript?
- How to handle proxy in Selenium in Java?
- How can I perform mouse hover action in Selenium-Python?
- How can I delete an element in Selenium using Python?
- How do I manually throw/raise an exception in Python?
- How to start selenium browser with proxy?
- How can I scroll a web page using selenium webdriver in python?
- How can I parse a website using Selenium and Beautifulsoup in python?
- Python Plotly – How to manually set the color of points in a scatter plot?
- Can I set any of the attribute value of a WebElement in Selenium?
- Is it possible to manually set the attribute value of a Web Element using Selenium?
- How can I clear text of a textbox using Python Selenium WebDriver?
- How can I set the 'backend' in matplotlib in Python?

Advertisements