import time from selenium.webdriver import Chrome from selenium.webdriver.common.keys import Keys web =Chrome() web.get("http://www..com") web.find_element_by_xpath('//*[@id="changeCityBox"]/p[1]/a').click() web.find_element_by_xpath('//*[@id="search_input"]').send_keys("python",Keys.ENTER) web.find_element_by_xpath('//*[@id="jobList"]/div[1]/div[1]/div[1]/div[1]/div[1]/a').click() #selenuim窗口的切换 web.switch_to_window(web.window_handles[1]) #detail=web.find_element_by_xpath('//*[@id="job_detail"]/dd[2]/div').text #print(detail) web.close() #变更窗口视角 web.switch_to_window(web.window_handles[0]) #iframe的提取 web.find_element_by_xpath('copy xpath') web.switch_to_frame(iframe) web.switch_to.default_content()#切换回原页面
学习爬虫第十五天
最新推荐文章于 2024-07-12 16:42:46 发布