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. Proxy support comes from SeleniumLibrary, which passes proxy settings to the underlying Selenium WebDriver via Chrome options or env vars.
Yes. Use different --variable PROXY_USER values per robot command, or define separate Suite Setup keywords that configure different proxy usernames.
Yes. RequestsLibrary respects HTTP_PROXY and HTTPS_PROXY environment variables, so API calls also route through KnoxProxy.
Yes. Configure the proxy on the Grid node, then use Open Browser with remote_url pointing to the Grid hub.
Free trial on rotating residential -- 5 minutes setup, no credit card.