Generation

generate functionSat, 27 May 2023

使用Microsoft Edge浏览器的指定用户打开指定网址,寻找搜索栏,在搜索栏内填写需要搜索的内容,提交后返回每页的内容

def search_with_edge(url, user, content): edge = webdriver.Edge(executable_path=r"C:\Program Files (x86)\Microsoft\Edge Dev\Application\msedge.exe") edge.get(url) edge.find_element_by_id("user").send_keys(user) edge.find_element_by_id("pwd").send_keys("123456") edge.find_element_by_id("submit").click() edge.find_element_by_id("kw").send_keys(content) edge.find_element_by_id("su").click() return edge.find_element_by_id("content_left").text search_with_edge("https://www.baidu.com/", "test", "a")

Questions about programming?Chat with your personal AI assistant