- 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 to handle proxy in Selenium in Java?
We can handle proxy in Selenium in Java with the help of PROXY class.
import java.io.IOException; import org.openqa.selenium.Proxy; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; public class ProxySelJav { public static void main(String[] args) { // TODO Auto-generated method stub WebDriver driver; String prox = "localhost:8080"; // set browser settings with Desired Capabilities Proxy p = new Proxy(); p.setHttpProxy(prox).setFtpProxy(prox).setSslProxy(prox) .setSocksProxy(prox); DesiredCapabilities c = new DesiredCapabilities(); c.setCapability(CapabilityType.PROXY, p); // utilize capabilities on launching browser driver driver = new Firefox(c); } }
- Related Articles
- How to handle frame in Selenium WebDriver using java?
- How to handle frames in Selenium?
- How to Handle alerts in Selenium?
- How to set Proxy in Firefox using Selenium WebDriver?
- How to start selenium browser with proxy?
- How to handle popup windows in Selenium?
- How to handle chrome notification in Selenium?
- How to handle web based alerts in Selenium?
- How to handle frames in Selenium with python?
- How to handle authentication popup with Selenium WebDriver using Java?
- How to handle frames in Selenium Webdriver in Python?
- How can we handle authentication popup in Selenium WebDriver using Java?
- How to handle child windows in Selenium with python?
- How can I manually set proxy settings in Python Selenium?
- Running Selenium Webdriver with a proxy in Python.

Advertisements