Python 我必须通过点击所有的职位名称来抓取linkedin网站,提取内容并在随后的50个网页上重复

Python 我必须通过点击所有的职位名称来抓取linkedin网站,提取内容并在随后的50个网页上重复,python,web-scraping,Python,Web Scraping,这是我的密码 from selenium import webdriver from time import sleep from selenium.common.exceptions import NoSuchAttributeException from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import numpy a

这是我的密码

from selenium import webdriver
from time import sleep 
from selenium.common.exceptions import NoSuchAttributeException
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import numpy as np

driver = webdriver.Firefox()
driver.get('https://www.linkedin.com/jobs/search?locationId=sg:0&orig=JSERP&start=0&count=25&trk=jobs_jserp_pagination_1')
result = []

while True:
   try:
       sleep(1)
       jobtitlebutton = driver.find_element_by_class_name('job-title-link')
       jobtitlebutton.click()
       result += driver.find_elements_by_class_name('content')
       driver.navigate().back()
       try:
           nextbutton = driver.find_element_by_class_name('next-btn')
           nextbutton.click()
       except:
           break
   except:
       sleep(2)

问题是,此代码只能单击第一个职务,并在那里停止。它不会刮取内容并导航到首页,然后重复其他职务。有50个职位的网页

请注意,最近。如果他们有工具来捕捉像这样天真的抓取尝试,我不会感到惊讶。哦,好吧,但是代码中有什么错误吗?我不认为这是一个问题,因为linkedin不允许刮取用户数据,但我刮取的不是用户数据