from selenium import webdriver from time import sleep
browser = webdriver.Edge(executable_path="msedgedriver.exe", capabilities={"browserName": "MicrosoftEdge", "version": "", "platform": "WINDOWS", "ms:edgeOptions": { 'extensions': [], 'args': ['--headless', '--disable-gpu']}}) browser.get("https://music.163.com/") sleep(2) browser.find_element_by_id('srch').click()
可以定位到网易云的输入框,但是无法与输入框交互错误提示:element not interactable,不用无头的时候却可以交互