将错误获取为";参数的类型不合法";实施",;“相对定位器”;使用;硒-java-4-α-6“;版本

将错误获取为";参数的类型不合法";实施",;“相对定位器”;使用;硒-java-4-α-6“;版本,java,selenium-webdriver,selenium-chromedriver,selenium4,Java,Selenium Webdriver,Selenium Chromedriver,Selenium4,错误日志: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import static org.openqa.selenium.support.locators.RelativeLocator.withTagName; public

错误日志:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import static org.openqa.selenium.support.locators.RelativeLocator.withTagName;

public class RelativeLocators {

public static void main(String[] args) {
    System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
    WebDriver driver = new ChromeDriver();
    driver.get("https://rahulshettyacademy.com/angularpractice/");
    WebElement name= driver.findElement(By.cssSelector("[name='name']"));
    System.out.println(driver.findElement(withTagName("label").above(name)).getText());
    
}

}
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}) on port 2870
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Nov 10, 2020 10:29:44 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Exception in thread "main" java.lang.IllegalArgumentException: Argument is of an illegal type: org.openqa.selenium.By$ByTagName
    at org.openqa.selenium.remote.internal.WebElementToJsonConverter.apply(WebElementToJsonConverter.java:85)
    at org.openqa.selenium.remote.internal.WebElementToJsonConverter.apply(WebElementToJsonConverter.java:79)
    at org.openqa.selenium.remote.internal.WebElementToJsonConverter.apply(WebElementToJsonConverter.java:79)
    at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
    at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
    at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
    at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:514)
    at org.openqa.selenium.support.locators.RelativeLocator$RelativeBy.findElements(RelativeLocator.java:176)
    at org.openqa.selenium.By.findElement(By.java:132)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:325)
    at RelativeLocators.main(RelativeLocators.java:15)