Using a proxy with Selenium is a simple process

While looking through the documentation, I came across a code snippet for using a proxy when building a driver:

var driver = new webdriver.Builder()
    .withCapabilities(webdriver.Capabilities.chrome())
    .setProxy(proxy.manual({http: 'host:1234'}))
    .build();

However, even when I tried using this code with the proxy '103.87.16.2:80' - .setProxy(proxy.manual({http: 'host:1234'})), my home IP address was still detected.

Can anyone help me figure out what might be causing this issue?

Answer №1

Setting a proxy in code for Chrome is not achievable. This information can be found in the Webdriver Advanced documentation.

Chrome

Similar to Internet Explorer, Chrome uses the same configuration as IE on Windows machines. On Mac, it utilizes System Preferences -> Network settings, and on Linux (specifically Ubuntu), it relies on System > Preferences > Network Proxy Preferences or setting http_proxy in "/etc/environment". Currently, there is no known method to programmatically set the proxy.

https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the most effective way to utilize zoom with an Orthographic projection?

I'm attempting to utilize THREE.OrbitControls for zooming in an orthographic projection, but I'm not achieving the desired outcome. I believe it may be possible to adjust the viewSize that is multiplied by left, right, top, and bottom to achieve ...

Navigating horizontally to find a particular element

I developed a unique Angular component resembling a tree structure. The design includes multiple branches and nodes in alternating colors, with the selected node marked by a blue dot. https://i.stack.imgur.com/fChWu.png Key features to note: The tree&ap ...

Using a bound data variable in a filter within an ng-repeat loop (Angular JS)

<!-- Left Navbar --> <div class="container-fluid" style="margin-top: 50px"> <div class="row"> <div class="col-sm-3 col-md-2 sidebar"> <ul ng-repeat="type in types" class="nav nav-sidebar"> <li>{{ ...

The JavaScript code for changing the text to a new line is not functioning correctly

I am attempting to convert a txt file into JSON format using JavaScript. When I input the txt in a single line like this, it works perfectly: <html> <body> <p id="demo"></p> <script> const txt = '{"nam ...

The sticky header is malfunctioning due to a null offsetTop value

import React , {useRef, useEffect} from 'react' import './header.css' const nav_links =[ { path:'#home', display:'Home' }, { path:'#about', display:'About& ...

My attempts to collect data from a class using selenium have been unsuccessful thus far

I am looking to extract data from the following website: and here is the corresponding html code: <div class="mod-reviews"> <div class="item">...</div> <div class="item">...</div> <di ...

TestNG.XML is failing to run when executed with Maven using the command 'mvn test', despite having correctly configured the POM.XML file

This is my first time asking a question on StackOverflow, so please excuse any inaccuracies. I have set up a maven project and am trying to run TestNG.XML through maven, but it's not working as expected. The output I'm getting is shown below: ...

What methods can I use to analyze the integrity of the data's structure?

Currently working on an API using NestJS and typeorm. I am in need of a way to verify the format of the data being returned to clients who make requests to it. For instance, when accessing the /players route, I expect the data to have a specific structure ...

Tips for integrating JSON information into nvd3 visualizations

I am a newcomer to Javascript and am struggling to identify the error in my code. My current project involves utilizing NVD3 charts, specifically a time series chart that displays dates along with the closing prices of a specific stock. The dataset spans f ...

The "main" entry for ts-node is not valid when running ts-node-dev

Recently, I embarked on a TypeScript project using yarn where I executed the following commands: yarn init -y yarn add typescript -D yarn tsc --init yarn add ts-node-dev -D Subsequently, I crafted a script titled dev that triggers tsnd src/index.ts, howev ...

Is there a way to verify the collectionFS database?

Is there a comparable method to query the CollectionFS database similar to how we access mongoDB? For instance, in mongoDB I can open the command line and navigate to the meteor project directory, then type "meteor mongo" followed by "db.users.find()". H ...

The functionality of a basic each/while loop in jQuery using CoffeeScript is not producing the desired results

I've been experimenting with different methods to tackle this issue. Essentially, I need to update the content of multiple dropdowns in the same way. I wanted to use an each or a while loop to keep the code DRY, but my experience in coffeeScript is li ...

Is it possible to retrieve all data from the Google translation API?

In my React app, the main component contains this function: componentDidMount(){ const land = ["Afrikaans", "Albanian", "Amharic", "Arabic", "Armenian", "Assamese", "Aymara", &qu ...

Your request must be a POST method and only absolute URLs are allowed

I have created a client-side app.js file that makes a post request to a server (code provided below): const fetch = require('node-fetch'); /* Function for POSTing data */ const postData = async ( url = 'http://localhost/8000/add ...

Tips for restricting camera movement in threejs

Being new to working with threejs, I am struggling to set limits on the camera position within my scene. When using OrbitControls, I noticed that there are no restrictions on how far I can zoom in or out, which I would like to change. Ideally, I want the c ...

Is it possible to automatically select the parent node after all child nodes have been individually selected in react-dropdown-tree-select?

I am encountering an issue with react-dropdown-tree-select. After selecting child nodes one by one, the parent node is not automatically selected. Is there a solution available? import React from 'react' import DropdownTreeSelect from 'react ...

The removal of all cookies using `driver.manage().deleteAllCookies()` with Selenium does not function properly in conjunction with browser options

There seems to be an issue with the browser Options in Selenium where driver.manage().deleteAllCookies() is not working as expected. Here is a snippet of the code showcasing this problem. var profile = new firefox.Profile('./fProfile'); profile. ...

I'm having trouble extracting text from the HTML code for an unknown reason

My code seems to be working well until I attempt to use the .text function, resulting in an error message stating "list' object has no attribute 'text". Interestingly, when I apply .text to a single element within the same list, it works without ...

Is there a way to display the form values on the table once it has been submitted?

I'm struggling with my form input not showing up under the table headings after submission. I've reviewed the code multiple times, but can't figure out what's causing the issue. If you have any suggestions on how to write the code more ...

Stop all file uploads using jQuery

I have integrated the jQuery File Upload plugin () into my website for image uploads. Here is my code snippet: $('#fileupload').fileupload({ url: 'server/index.php', dataType: 'json', dropZone: $('#dropzone&a ...