Verify that your mobile ads are displayed correctly to real users using IPRoyal's Mobile Proxies and Playwright browser automation.
Mobile ad verification often fails because automated traffic doesn't resemble real mobile users. Mobile proxies solve this by routing requests through genuine mobile ISPs. Since mobile networks use Carrier-Grade NAT (where thousands of users share a single IP), websites are extremely reluctant to block mobile IPs - making them ideal for reliable ad verification.
With this approach you can:
- Confirm ads are actually being served to real mobile users
- Detect fraudulent impressions
- Validate campaign performance by location, device, and carrier
- Scale verification across multiple URLs and devices
The included Python script uses Playwright to emulate a mobile device (e.g., iPhone 15) and routes traffic through an IPRoyal mobile proxy. The target webpage sees a genuine mobile user, so ads load normally - allowing you to capture screenshots and verify ad placement.
pip install playwright
playwright install chromiumThis section imports time (Python module) that controls the time we wait for the website to load. It also loads Playwright, which controls the Chromium browser that will display the website and ads. Finally, it sets the target website's URL and covers the proxy configuration used to access it.
import time
from playwright.sync_api import sync_playwright
TARGET_URL = "https://www.bbc.com/news"
PROXY_SERVER = "http://us9.4g.iproyal.com:7044"
USERNAME = "your_username"
PASSWORD = "your_password"You can get your proxy credentials from the IPRoyal dashboard.
This section tells the browser how to present itself to the target website. We don't need to specify anything - Playwright sets the screen size, touch-screen capability, and the user-agent automatically.
mobile_device = p.devices['iPhone 15']This controls the actual browser window. The args line is our "stealth mode" - it hides the fact that we're running this script on a PC to control the browser and makes it look like a genuine mobile user is accessing the website.
browser = p.chromium.launch(
headless=False,
args=["--disable-blink-features=AutomationControlled"]
)This section starts a new browser session, applies the iPhone settings, and forces all traffic through our mobile proxy.
context = browser.new_context(
**mobile_device,
proxy={
"server": PROXY_SERVER,
"username": USERNAME,
"password": PASSWORD
}
)The script visits the website. It waits 10 seconds for ads to load.
page = context.new_page()
print(f"Navigating to {TARGET_URL}...")
page.goto(TARGET_URL)
print("Waiting 10 seconds for ad content to stabilize...")
time.sleep(10)Since filenames cannot safely contain characters like / and :, the script converts the URL into a filesystem-friendly name by replacing separators with underscores. For example, https://www.bbc.com/news becomes www_bbc_com_news.png.
safe_name = TARGET_URL.replace("https://", "").replace("http://", "").replace("/", "_").replace(".", "_")
filename = f"{safe_name}.png"This section tells the browser to capture every pixel visible in the mobile viewport and save it to the same folder where our script is. Then it shuts down Chromium.
page.screenshot(path=filename)
print(f"Screenshot captured! Check {filename}")
browser.close()import time
from playwright.sync_api import sync_playwright
TARGET_URL = "https://www.bbc.com/news"
PROXY_SERVER = "http://us9.4g.iproyal.com:7044"
USERNAME = "your_username"
PASSWORD = "your_password"
def run_ad_verification():
with sync_playwright() as p:
mobile_device = p.devices['iPhone 15']
browser = p.chromium.launch(
headless=False,
args=["--disable-blink-features=AutomationControlled"]
)
context = browser.new_context(
**mobile_device,
proxy={
"server": PROXY_SERVER,
"username": USERNAME,
"password": PASSWORD
}
)
page = context.new_page()
print(f"Navigating to {TARGET_URL}...")
page.goto(TARGET_URL)
print("Waiting 10 seconds for ad content to stabilize...")
time.sleep(10)
safe_name = TARGET_URL.replace("https://", "").replace("http://", "").replace("/", "_").replace(".", "_")
filename = f"{safe_name}.png"
page.screenshot(path=filename)
print(f"Screenshot captured! Check {filename}")
browser.close()
if __name__ == "__main__":
run_ad_verification()