Skip to content

Refactor Selenium element location methods for compatibility #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions linkedin_scraper/job_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def scrape_job_card(self, base_element) -> Job:
job_div = self.wait_for_element_to_load(name="job-card-list__title", base=base_element)
job_title = job_div.text.strip()
linkedin_url = job_div.get_attribute("href")
company = base_element.find_element_by_class_name("artdeco-entity-lockup__subtitle").text
location = base_element.find_element_by_class_name("job-card-container__metadata-wrapper").text
company = base_element.find_element(By.CLASS_NAME, "artdeco-entity-lockup__subtitle").text
location = base_element.find_element(By.CLASS_NAME, "job-card-container__metadata-wrapper").text
job = Job(linkedin_url=linkedin_url, job_title=job_title, company=company, location=location, scrape=False, driver=self.driver)
return job

Expand All @@ -55,7 +55,7 @@ def scrape_logged_in(self, close_on_complete=True, scrape_recommended_jobs=True)
if not area_name:
continue
area_results = []
for job_posting in area.find_elements_by_class_name("jobs-job-board-list__item"):
for job_posting in area.find_elements(By.CLASS_NAME, "jobs-job-board-list__item"):
job = self.scrape_job_card(job_posting)
area_results.append(job)
setattr(self, area_name, area_results)
Expand Down