|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- from selenium.webdriver import Firefox
- from selenium.webdriver.common.keys import Keys
- import time
- web = Firefox()
- web.get("http://lagou.com")
- web.find_element_by_xpath('//*[@id="cboxClose"]').click()
- time.sleep(1)
- web.find_element_by_xpath('//*[@id="search_input"]').send_keys('python', Keys.ENTER)
- time.sleep(1)
- content = web.find_elements_by_xpath('/html/body/div[6]/div[3]/div[1]/div[3]/ul/li')
- print(content)
复制代码
这是一个爬取拉勾网上python求职岗位的程序。
但是运行出来后,爬取的数据竟然为空。
一时没找到问题在哪,哪位前辈帮忙看看啊,谢谢啊!
多等一会
- from selenium.webdriver import Firefox
- from selenium.webdriver.common.keys import Keys
- import time
- web = Firefox()
- web.get("http://lagou.com")
- web.find_element_by_xpath('//*[@id="cboxClose"]').click()
- time.sleep(1)
- web.find_element_by_xpath('//*[@id="search_input"]').send_keys('python', Keys.ENTER)
- time.sleep(10)
- result = web.find_elements_by_xpath('//li')
- print(result)
复制代码
|
|