html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CSS1</title> </head> <body> <div id='div1'> <div id='div2' > <P>这是段落1</p> <P>这是段落2</p> <form > <button>登录1</button><br><br> 账号<input type="text" name="username" id="ls_username" class="pn vm"><br><br> 密码<input type="text" name="password" id="ls_password" class="pn vm"><br><br> </form> <p>这是段落3</p> <a href="">baidu</a> </div> <div id='div3'> <p>这是段落4</p> <button type="button" id="loginbutton">登录</button> </div> </div> </body> </html>
选取器 表达式
elements = driver.find_elements(By.CSS_SELECTOR, "#div2>:nth-child(3) input")
选取器 #div2>:nth-child(3) input
标签:段落,elements,伪类,选取,SELECTOR,CSS From: https://www.cnblogs.com/haha1988/p/17733088.html