webdriver根据XPath相对路径获取元素
#encoding = utf-8 import time from selenium import webdriver from selenium.webdriver.common.by import By driver = webdriver.Chrome() #打开百度首页 driver.get("https://passport.meituan.com/account/unitivelogin?") #根据相对路径获取元素 driver.find_element(by=By.XPATH,value="/html/body/div[5]/div/div[2]/form[1]/div[2]/input[2]").send_keys("134") #暂停6秒 time.sleep(6)
标签:XPath,webdriver,driver,相对路径,import,div From: https://www.cnblogs.com/dongtian/p/17498778.html