Links delen - Ricktijink/FeDProject GitHub Wiki

foto's:


Links:

Form select:

__


from selenium import webdriver from selenium.webdriver.common.keys import Keys import time

driver = webdriver.Chrome('./chromedriver.exe') # like c:\ .. \chromedriver.exe

herhaal = True aantal_interacties = 0 while herhaal: aantal_interacties = aantal_interacties + 1 driver.get("https://www.youtube.com/?gl=NL&hl=nl")

assert "YouTube" in driver.title
time.sleep(2)
# find hamburger menu
elem = driver.find_element_by_id("guide-icon")
elem.click()

time.sleep(2)
elem = driver.find_element_by_id("guide-button")
elem.click()

time.sleep(2)
# find search input and search for selenium
elem = driver.find_element_by_id("search")
elem.send_keys("selenium")
elem.send_keys(Keys.RETURN)


time.sleep(2)
# assert "YouTube" in driver.title  # this will throw an assert error

if aantal_interacties > 5:
    herhaal = False
    driver.close()