On a web page, this element is the only one containing the exact text 'Volgende stap':
<span class="b-button--label ng-binding ng-scope" ng-if="arrowDirection === 'right'">Volgende stap</span>
But when I try to select (a list of) the elements containing these words using xpath:
driver.find_elements_by_xpath("//span[contains(text(),'Volgende')]")
driver.find_elements_by_xpath("//span[.='Volgende stap']")
driver.find_elements_by_xpath("//span[text()='Volgende stap']")
I keep getting an empty list (or element not found
in case of find_element
instead of find_elements
).
This is the script leading to the html page I'm working on:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait as wait
driver = webdriver.Chrome()
driver.get("https://www.greetz.nl/kaarten/verjaardag/man")
wait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "a[href*='/kaart/detail/greetz-verjaardagskaart---abracadabra/1142778148']"))).click()
wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//span[text()='Kaart bewerken']"))).click()