关于相对定位器,Selenium官网文档的介绍介绍了五种相对定位器:above,below,leftof,rightof,near并给出了例子:email_locator=locate_with(By.TAG_NAME,"input").above({By.ID:"password"})其中相对定位器(relativelocator)方法(此处即above()),参数既可以传元素对象也可以传locator。官网的例子统一只用了locator,直接传一个之前定位好的element也是可以的:origin_element=driver.find_element(By.ID,"password")e