为什么使用find_element_by_xpath方法的时候属性值总会报错?求解
程序代码:
# -*- coding:utf-8 -* from selenium import webdriver import time driver = webdriver.Chrome('D:\python3.6.8\Scripts\chromedriver.exe') driver.get('http://0002.yun.') driver.maximize_window() time.sleep(1) driver.find_element_by_id('user').send_keys('lyy') # 输入登录账号 driver.find_element_by_id('password').send_keys('123456') # 输入登录密码 time.sleep(1) # -----------Xpath-------------- driver.find_element_by_xpath('/html/body/div/form/div/button').click() # 点击登录按钮 time.sleep(1) driver.find_element_by_id('ext-comp-1020').click() # 点击【健康管理】模块 driver.find_element_by_xpath("//div[@id="ext-comp-1020"]/") # id属性值报错