automated speedtests with selenium

88 views
Skip to first unread message

Buckaroo Banzai

unread,
Nov 30, 2021, 2:14:23 AM11/30/21
to Selenium Users
Hi all,

I'm trying to run automated speedtests for my cable provider.

While speedtest pages like 'breitbandmessung.de' work like a charm, my provider's page doesn't.

The page in question is speedtest.unitymedia.de. When I click() on the 'start' button, the page determines my booked speed and should then begin with the speedtests. Unfortunately, nothing happens apart from … let's call it a downstream-test-animation. Normally, the whole speedtest would have been completed way before the 300s I gave the script, but nada.

Am I missing something here?

Kind regards,
Buck

--%snip%--
#!/usr/bin/python3

import time
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--window-size=1440,900')
options.add_argument('--force-device-scale-factor=1')
options.add_argument('--disable-extensions')
options.add_argument('--disable-translate')
options.add_argument('--no-first-run')
options.add_argument('--no-default-browser-check')
options.add_argument('--disable-features=InfiniteSessionRestore,TranslateUI')

driver = webdriver.Chrome('chromedriver', options=options)
driver.implicitly_wait(3)

driver.save_screenshot("unitymedia_debug001.png")

btn = driver.find_element_by_css_selector("[data-id='speedtest_start']")
if btn: btn.click()
else:
    driver.quit()
    exit(1)

i = 1
while i < 300:
    i+=1
    time.sleep(1)
    driver.save_screenshot("unitymedia_debug%03d.png" % i)
driver.quit()

--%snip%--

David

unread,
Dec 3, 2021, 12:07:50 AM12/3/21
to Selenium Users
Maybe the site in question checks if Selenium is used and behaves differently in that case? You might want to look at other alternatives, or try other automations tools like Cypress/Playwright/Puppeteer in case Selenium doesn't work.
Reply all
Reply to author
Forward
0 new messages