• Синтаксис find_element в Selenium 4?

    ScriptKiddo
    @ScriptKiddo
    https://www.selenium.dev/documentation/getting_sta...

    До

    driver.findElementsByClassName("className");
    driver.findElementsByCssSelector(".className");
    driver.findElementsById("elementId");
    driver.findElementsByLinkText("linkText");
    driver.findElementsByName("elementName");
    driver.findElementsByPartialLinkText("partialText");
    driver.findElementsByTagName("elementTagName");
    driver.findElementsByXPath("xPath");

    После

    driver.findElements(By.className("className"));
    driver.findElements(By.cssSelector(".className"));
    driver.findElements(By.id("elementId"));
    driver.findElements(By.linkText("linkText"));
    driver.findElements(By.name("elementName"));
    driver.findElements(By.partialLinkText("partialText"));
    driver.findElements(By.tagName("elementTagName"));
    driver.findElements(By.xpath("xPath"));


    Пример на Java, в Python аналогично

    By находится здесь

    from selenium.webdriver.common.by import By
    driver.find_element(By.XPATH, xpath)
    Ответ написан
    2 комментария