Skip to content

Commit

Permalink
mostly working now
Browse files Browse the repository at this point in the history
  • Loading branch information
snapfast committed Sep 17, 2023
1 parent 1d93687 commit c6cb3c5
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 245 deletions.
41 changes: 27 additions & 14 deletions LINKEDIN/connect_people.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from functools import reduce
from selenium.webdriver.chrome.service import Service

from time import sleep
Expand Down Expand Up @@ -42,24 +43,33 @@ def connect(self):

html = self.driver.find_element(by=By.TAG_NAME, value='html')
j = 0
total_jobs = 0

while 1:
html.send_keys(Keys.END)
sleep(1)
# left panel jobs
try:
visible_connect_buttons = self.driver.find_elements(
by=By.XPATH, value="//button[@class='artdeco-button artdeco-button--2 artdeco-button--secondary ember-view full-width']")
except NoSuchElementException as NoSuch:
print(NoSuch, "\n cool")

total_jobs = len(visible_connect_buttons)
if total_jobs < 200:
html.send_keys(Keys.END)
sleep(1)
# left panel jobs
try:
visible_buttons = self.driver.find_elements(
by=By.XPATH, value="//button[@class='artdeco-button artdeco-button--2 artdeco-button--secondary ember-view full-width']")
except NoSuchElementException as NoSuch:
print(NoSuch, "\n cool")
else:
j += 1

# visible_connect_buttons = reduce(check_connect_text ,visible_buttons, [])
total_jobs = len(visible_buttons)
print(total_jobs, j)

try:
self.driver.execute_script(
"window.scrollTo(0, arguments[0].offsetTop);", visible_connect_buttons[j])
job_name_element = visible_connect_buttons[j].click()
"window.scrollTo(0, arguments[0].offsetTop);", visible_buttons[j])
if visible_buttons[j].text == "Connect":
job_name_element = visible_buttons[j].click()
else:
print(visible_buttons[j].text)
continue

print(job_name_element)

Expand All @@ -73,8 +83,11 @@ def connect(self):
sleep(2)
except NoSuchElementException:
print('asking for person email for connect, clicking X, move to next')
self.driver.find_element(
by=By.XPATH, value="//button[@class='artdeco-modal__dismiss artdeco-button artdeco-button--circle artdeco-button--muted artdeco-button--2 artdeco-button--tertiary ember-view']").click()
self.driver.find_element(by=By.CSS_SELECTOR, value='button[aria-label="Dismiss"]').click()


def check_connect_text(first, second):
return [first, second]


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion LINKEDIN/profile_stalker.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, any_profile_link):
f"--user-data-dir={local_bin_directory}/chrome-data")
chrome_options.add_experimental_option("useAutomationExtension", False)

service = Service(local_bin_directory + '/chromedriver/chromedriver')
service = Service()

self.driver = webdriver.Chrome(service=service, options=chrome_options)
self.driver.get(any_profile_link)
Expand Down
184 changes: 0 additions & 184 deletions LINKEDIN/recommended_jobs.py

This file was deleted.

35 changes: 4 additions & 31 deletions LINKEDIN/recommended_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,37 +30,13 @@ def __init__(self):
service = Service()

self.driver = webdriver.Chrome(service=service, options=chrome_options)
self.driver.get("https://linkedin.com/jobs")
self.driver.get("https://www.linkedin.com/jobs/collections/recommended/")
sleep(2)

def go_exit(self):
self.driver.close()
self.driver.quit()

def do_search(self, position = "software engineer", location = "germany"):
box = self.driver.find_elements(by=By.CLASS_NAME,
value="jobs-search-box__text-input")
box[0].click()
sleep(1)
box[0].send_keys(position) # job title
box[3].send_keys(location + "\n") # location
sleep(5)

# turn on filter for the Easy Apply Jobs, all jobs will be easy ones
try:
easy_apply_filter_parent = self.driver.find_element(
by=By.CLASS_NAME,
value='search-reusables__filter-binary-toggle')
easy_apply_filter_parent.find_element(by=By.TAG_NAME,
value='button').click()
print(easy_apply_filter_parent.text)
except:
print("not able to find the easy button")

sleep(5)
self.change_page()
sleep(5)

def change_page(self):
# get the current page number, self.page_number
# then find that page number element, then click the element
Expand Down Expand Up @@ -194,10 +170,7 @@ def apply_job(self):


if __name__ == '__main__':
position = argv[1]
location = argv[2]

lb = LinkedinBot()
lb.do_search(position, location)
lb.click_easy_jobs()
lb.change_page()
rp = LinkedinBot()
rp.click_easy_jobs()
rp.change_page()
7 changes: 0 additions & 7 deletions LINKEDIN/search_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,6 @@ def apply_job(self):
gerat = True
while gerat:
try:
'''
self.driver.find_element(
by=By.XPATH,
value="//button[@class='jobs-apply-button']"
# value="//button[@class='jobs-apply-button artdeco-button artdeco-button--3 artdeco-button--primary ember-view']"
).click()
'''
sleep(3)
self.driver.find_element(by=By.CLASS_NAME, value="jobs-apply-button").click()
print('Clicked the Easy Button')
Expand Down
2 changes: 1 addition & 1 deletion NAUKRI/recommended_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self):
chrome_options.add_experimental_option("useAutomationExtension", False)
# chrome_options.add_experimental_option('excludeSwitches', ["enable-automation"])

service = Service(local_bin_directory + '/chromedriver/chromedriver')
service = Service()

self.driver = webdriver.Chrome(service=service, options=chrome_options)
self.driver.get("https://www.naukri.com/mnjuser/recommendedjobs")
Expand Down
14 changes: 7 additions & 7 deletions run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import setup
from time import sleep
from BUMBLE import swipe
from LINKEDIN import recommended_jobs as l_rec
from LINKEDIN import recommended_page
from LINKEDIN import search_jobs
from LINKEDIN import connect_people
from LINKEDIN import profile_stalker
Expand All @@ -25,7 +25,7 @@

print("""
Which service to automate ?
1. Angel List
1. WellFound
2. Linkedin
3. Naukri
4. Bumble
Expand All @@ -42,14 +42,14 @@
Choose below ?
1. Apply Linkedin Recommended Jobs.
2. Search based on Position and Location.
3. Connect to People of the Company (https://www.linkedin.com/company/paypal/people/)
4. Stalk Profiles :P
3. Connect to Company People (paypal, nvidia, tesla, etc.)
4. Stalk Profiles (opens a link from profile you give, then keeps on.)
""")
LINKEDIN_SERVICE = int(input())
if LINKEDIN_SERVICE == 1:
print("Applying Linkedin Recommended..")
lb = l_rec.LinkedinBot()
lb.click_job()
print("Applying Linkedin Recommended Page..")
rp = recommended_page.LinkedinBot()
rp.click_easy_jobs()
elif LINKEDIN_SERVICE == 2:
print("Searching on Linkedin.")
position = input("\nEnter post name\n")
Expand Down

0 comments on commit c6cb3c5

Please sign in to comment.