How to locate and click "speed test" link on netflix using selenium in python? How to locate and click "speed test" link on netflix using selenium in python? selenium selenium

How to locate and click "speed test" link on netflix using selenium in python?


The element with text as Speed Test is out ofthe Viewport so you need to induce WebDriverWait for the desired element to be clickable() and you can use the following Locator Strategy:

  • Using XPATH:

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@class='footer-link']/span[text()='Speed Test']"))).click()
  • Note : You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support import expected_conditions as EC


Use WebDriverWait and element_to_be_clickable with following xpath.

from selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom selenium import webdriverdriver = webdriver.Chrome()driver.get("https://www.netflix.com/")elem = WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"//span[@data-uia='data-uia-footer-label'][contains(.,'Speed Test')]")))elem.click()

Browser snapshot:

enter image description here

To added to this answer you need to use WebDriverWait and then click on the element Show more info

from selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECfrom selenium import webdriverdriver = webdriver.Chrome()driver.get("https://www.netflix.com/")elem = WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"//span[@data-uia='data-uia-footer-label'][contains(.,'Speed Test')]")))elem.click()WebDriverWait(driver,60).until(EC.element_to_be_clickable((By.XPATH,"//a[contains(.,'Show more info' )]"))).click()