Robot Framework is a generic keyword-driven test automation framework popular in enterprise QA. Combine it with SeleniumLibrary and KnoxProxy to automate geo-targeted browser tests, verify localized workflows, and validate region-specific UI behavior using readable test syntax.
Install the framework and browser automation library.
pip install robotframework robotframework-seleniumlibraryExport proxy variables before running Robot tests. SeleniumLibrary passes these to the browser.
export HTTP_PROXY=http://USER:PASS@gw.knoxproxy.com:7000
export HTTPS_PROXY=http://USER:PASS@gw.knoxproxy.com:7000Define proxy settings in a Robot Framework variables file.
# variables/proxy.py
PROXY_HOST = "gw.knoxproxy.com"
PROXY_PORT = "7000"
PROXY_USER = "USER"
PROXY_PASS = "PASS"
PROXY_URL = f"http://{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}"Pass proxy arguments to Chrome via SeleniumLibrary keywords.
*** Settings ***
Library SeleniumLibrary
Variables variables/proxy.py
*** Keywords ***
Open Proxied Browser
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
Call Method ${options} add_argument --proxy-server\=http://${PROXY_HOST}:${PROXY_PORT}
Create WebDriver Chrome options=${options}Change the proxy username variable for geo-targeted tests.
# Run with country-specific proxy
export HTTP_PROXY=http://USER-country-in:PASS@gw.knoxproxy.com:7000
robot --variable PROXY_USER:USER-country-in tests/Execute Robot Framework tests with proxy routing.
HTTP_PROXY=http://USER:PASS@gw.knoxproxy.com:7000 \
HTTPS_PROXY=http://USER:PASS@gw.knoxproxy.com:7000 \
robot --outputdir results tests/geo_tests.robot*** Settings ***
Library SeleniumLibrary
Suite Setup Open Proxied Browser
Suite Teardown Close All Browsers
*** Variables ***
${PROXY_HOST} gw.knoxproxy.com
${PROXY_PORT} 7000
*** Keywords ***
Open Proxied Browser
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
Call Method ${options} add_argument --proxy-server\=http://${PROXY_HOST}:${PROXY_PORT}
Call Method ${options} add_argument --headless\=new
Create WebDriver Chrome options=${options}
*** Test Cases ***
Verify Proxy Exit IP
Go To https://httpbin.org/ip
Page Should Contain Element tag:pre
${body}= Get Text tag:pre
Log Exit IP: ${body}
Load Localized Page
Go To https://example.com
${title}= Get Title
Should Not Be Empty ${title}
Log Page title: ${title}Each Suite Setup opens a new browser with a fresh proxy connection. For sticky sessions, use USER-session-{id} in the proxy username. For IP rotation between test cases, close and reopen the browser in a Test Setup keyword.
| Problem | Fix |
|---|---|
| WebDriverException: Message: unknown error: net::ERR_PROXY_CONNECTION_FAILED | Verify --proxy-server argument value. Check that gw.knoxproxy.com:7000 is accessible from the test machine. |
| SeleniumLibrary: Timeout 10 seconds exceeded | Increase the SeleniumLibrary timeout: Set Selenium Timeout 30s in Suite Setup, or pass --variable SELENIUM_TIMEOUT:30. |
| Keyword "Create WebDriver" failed: cannot find Chrome binary | Install Chrome and ChromeDriver. Ensure chromedriver is in PATH or specify its location via executable_path. |
USER-country-de-city-berlin-session-profile07Order matters -- geo flags before the session flag. The session name is free text; use the profile ID so the mapping is self-documenting. Password stays as issued; no flags belong there. HTTP on :7000, SOCKS5 on :7001, same credentials.
Robot Framework itself is tool-agnostic and has no proxy feature of its own. Proxy support instead comes from SeleniumLibrary, which passes proxy settings to the underlying Selenium WebDriver through Chrome options like --proxy-server or through HTTP_PROXY and HTTPS_PROXY environment variables that SeleniumLibrary inherits when it launches the browser.
Yes, pass different --variable PROXY_USER values on the robot command line per test suite, for example PROXY_USER:USER-country-in for one run and a different country code for the next. Alternatively, define separate Suite Setup keywords in each .robot file that hardcode different proxy usernames, if you prefer not to pass CLI variables.
Yes, RequestsLibrary is built on the Python requests package, which respects the same HTTP_PROXY and HTTPS_PROXY environment variables used by SeleniumLibrary browser tests. That means API-level keywords in your .robot test suites route through KnoxProxy automatically, without any extra proxy configuration beyond exporting those two variables beforehand.
Yes, configure the proxy at the Grid node level with HTTP_PROXY and HTTPS_PROXY environment variables, exactly as you would for any Grid deployment. Then use the Open Browser keyword in SeleniumLibrary with a remote_url argument pointing to the Grid hub, and your Robot Framework tests inherit the proxied Grid sessions.
Rotating residential proxies -- 5 minutes setup, instant activation, 14-day money-back guarantee.