我目前正在使用python shell中的selenium抓取Linkedin Job目录
driver = webdriver.Firefox()
driver.get('https://www.linkedin.com/jobs/search?
locationId=sg%3A0&f_TP=1%2C2&orig=FCTD&trk=jobs_jserp_posted_one_week')
a = driver.find_elements_by_class_name('job-title-text')
b = driver.find_elements_by_class_name('company-name-text')
c = driver.find_elements_by_class_name('job-location')
d = driver.find_elements_by_class_name('job-description')
#There are 50 pages of jobs therefore I specified a range of 55
for e in range(55):
for g in a:
print(g.text)
for h in b:
print(h.text)
for i in c:
print(i.text)
for j in d:
print(j.text)
k = driver.find_element_by_class_name('next-btn')
k.click()
Job = []
Job.append(a)
Job.append(b)
Job.append(c)
Job.append(d)
for l in Job:
print(l.text)
此代码无效,我一直在努力并尝试各种方法来解决此问题。如果我能得到正确的解决方案,那就太好了。
答案 0 :(得分:0)
for e in range(55):
for g in a:
print(g.text)
job.append(g)
for h in b:
print(h.text)
job.append(h)
for i in c:
print(i.text)
job.append(i)
for j in d:
print(j.text)
job.append(j)
也许你应该得到这样的工作清单。
答案 1 :(得分:0)
我真的不明白你的问题。也许你可以从枚举(列表)中获得一些想法
例如:
List<Number> numList = new ArrayList<Number>();
Integer f = 100;
numList.add(f);