You were close enough. The actual implementation is:
self.find_element(by=By.PARTIAL_LINK_TEXT, value=link_text)
So you need to pass two parameters,
So your effective line of code will be:
browser.find_element(By.PARTIAL_LINK_TEXT, "/watch")
Finally, click()
doesn't returns anything, so if to try to assign it to a variable, it will be always NULL
. So better to drop it.
So your working line of code will be:
browser.find_element(By.PARTIAL_LINK_TEXT, "/watch").clcik()
Ideally to invoke click()
you need to induce WebDriverWait for the element_to_be_clickable()
and you can use either of the following Locator Strategy:
WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT, "/watch"))).click()
Note : You have to add the following imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC