The new version of Selenium doesn’t have any old methods, like .find_element_by_xpath()
, but it introduced the new fabrique method .find_element(By.XPATH, searched_string)
. Here is the example from the documentation:
vegetable = driver.find_element(By.CLASS_NAME, "tomatoes")
But it does not work, because 'By' is not defined. I can't find the example what to import to use this pattern. In Java it is:
import org.openqa.selenium.By;
And what should I do in Python?