Integrating Selenium with XProxy
Ask AI
Ready taskAdd this to my code
Coding agents
Claude CodeOpens the desktop appCodexOpens the desktop appCursorOpens the app from the webChat assistants
Open in ChatGPTNew tabOpen in ClaudeNew tabCopy
View as MarkdownPlain text for AI toolsSee the prompt
Read https://xproxy.io/document/integrating-selenium-with-xproxy.md, the XProxy guide "Integrating Selenium with XProxy". If you cannot open links, download them with curl. Then add it to my project: read my code, use the language and libraries it already uses, keep proxy logins and API keys in environment variables, and show me how to test it. Other XProxy guides, each with a Markdown copy at its URL + .md, are listed in https://xproxy.io/llms.txt.
The app opens with the prompt filled in. Nothing runs until you press Enter.
Send Selenium and Chrome through an XProxy mobile proxy, and change the IP from your Python code.
In short
One --proxy-server argument sends Chrome through your XProxy proxy.
Call one URL on your panel before you start Chrome. The modem gets a new IP in a few seconds.
Open an IP page and print it. It must match the Public IP of that proxy in your panel.
You need: Python 3 with Selenium and Chrome installed, and an XProxy panel with a working modem.
Chrome needs a proxy without a password
Chrome cannot take a username and password in --proxy-server. Use the Whitelist IP login for this script:
- In your XProxy panel open Proxy Settings → Login and turn on Whitelist IP (Basic plan or higher).
- Add the public IP of the computer that runs Selenium.
- In Proxy Management, click Export Proxy. Set Protocol to HTTP and Credentials to No credentials (
host:port), then click Copy All.
Open a page through XProxy
from selenium import webdriver
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument("--proxy-server=http://192.168.1.10:4001") # from Export Proxy
options.add_argument("--headless=new") # optional: no window
driver = webdriver.Chrome(options=options)
try:
driver.get("https://api.ipify.org?format=json")
print(driver.find_element(By.TAG_NAME, "body").text) # {"ip":"..."}
finally:
driver.quit()
Needs pip install selenium. Selenium 4.6 or newer finds the Chrome driver for you.
Change the IP from code
Position 1 is the first modem, the one on port 4001 when the starting port is 4000. The code calls the rotation API, then asks the panel for the modem's status until it says MODEM_READY. All calls are in How to change / rotate IP.
auth=("USER", "PASS") to each requests.get.Check it works
- Run the first script. It prints an IP address.
- In Proxy Management, look at the Public IP of that proxy (marked 1). It is the same IP.
- Run the second script. It prints a new IP twice: the one from the panel call and the one Chrome sees.

Something not working?
| You see | What to do |
|---|---|
| Chrome shows a proxy error page, or asks for a login | The proxy still wants a password. Add your computer's public IP to Whitelist IP as shown above, or use Playwright with a username and password. |
| Connection refused or timed out | The address is not reachable from your computer. A LAN only address works only on your own network: use Public address or VPS relay (public access). Also check the port in Proxy Management. |
| The printed IP is your own IP | The request did not go through the proxy. Check that the proxy is passed to the request, the browser or the crawler, and that it is not set only for http or only for https. |
The rotation call fails or says status is false | Check the position number and the panel address. If Force API Auth is on, add your dashboard login to the call. |
| The IP is the same after rotating | Sometimes the carrier gives the modem the same IP. Rotate again. The status call can also answer COLLISION_IP when IP unchanged detect is on in Rotation Settings. |
What next?
Change the IP on a timer, or copy your proxies in another format.

