<jupyter_start><jupyter_text>Web Scrapping using Selenium    Importing all the required libraries<jupyter_code>from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
import pandas as pd<jupyter_output><empty_output><jupyter_text>Set the path of your chrome driver<jupyter_code>chrome_path = r"C:\Users\KAK12\AppData\Local\Continuum\Anaconda3\Scripts\chromedriver.exe"

driver = webdriver.Chrome(chrome_path)<jupyter_output><empty_output><jupyter_text>The link you want to scrape(I am scrapping the LinkedIn website)<jupyter_code>driver.get("https://www.linkedin.com/jobs/")<jupyter_output><empty_output><jupyter_text>Extracting the Domains in the job listing page<jupyter_code>Domain=[]
for i in range(1,7):
	result = driver.find_element_by_xpath('//*[@id="content-outlet"]/section[2]/div[%s]/a/section/h4'%(i)).text
	Domain.append(result)
Domain<jupyter_output><empty_output><jupyter_text>Extracting the link of each of the Domains page<jupyter_code>link = []
for i in range(1,7):
	result1 = driver.find_element_by_xpath('//*[@id="content-outlet"]/section[2]/div[%s]/a'%(i)).get_attribute("href")
	link.append(result1)
link<jupyter_output><empty_output><jupyter_text>Iterating through the link and grabbing the number of job postings specific to each domain<jupyter_code>#Number of job postings
a=[]
for i in range(1,7): 
	driver.find_element_by_xpath('//*[@id="content-outlet"]/section[2]/div[%s]/div/a'%(i)).click()
	a.append(driver.find_element_by_xpath('//*[@id="content-outlet"]/div/section[3]/div[2]/div/section[1]/div/div[1]/div/div/strong').text)
	#To go back to the previous page
	driver.execute_script("window.history.go(-1)")<jupyter_output><empty_output><jupyter_text>Converting it to a dataframe<jupyter_code>job_listing_df = pd.DataFrame({'Domain' : Domain , 'Link' : link , 'No_of_Job_openings' : a})
job_listing_df<jupyter_output><empty_output><jupyter_text>Getting the input from the user about the job title and location and passing it on to the browser<jupyter_code>#Enter the Job_position
job_title = input("Enter a Job_title: ")
job_seach=driver.find_element_by_xpath('//*[@id="keyword-search-box"]').clear()
job_search=driver.find_element_by_xpath('//*[@id="keyword-search-box"]')
job_search.send_keys(job_title)

#Enter the location
job_locate = input("Enter a Job_location: ")
job_location=driver.find_element_by_xpath('//*[@id="location-search-box"]').clear()
job_location=driver.find_element_by_xpath('//*[@id="location-search-box"]')
job_location.send_keys(job_locate)

#Search
driver.find_element_by_xpath('//*[@id="content-outlet"]/section[1]/div/div/section/form/div/button').click()<jupyter_output>Enter a Job_title: Data Analytics
Enter a Job_location: Dallas, Texas<jupyter_text>Getting the number of job openings for the specific job title and location<jupyter_code>driver.find_element_by_xpath('//*[@id="content-outlet"]/div/section[3]/div[2]/div/section[1]/div/div[1]/div/div/strong').text<jupyter_output><empty_output><jupyter_text>Feeding in the US_Cities and States Dataset<jupyter_code>city_state = pd.read_csv("city_State_database.csv")
city_state.head()

city_state['Location'] = city_state['primary_city'] + ", " +city_state['state']<jupyter_output><empty_output><jupyter_text>Passing in the Location value to grab the count of job openings but US cities and states for Data Analytics position<jupyter_code>job_posts = []
for i in city_state['Location'].iloc[0:29785]:
    
    time.sleep(30)
    
    job_seach=driver.find_element_by_xpath('//*[@id="keyword-search-box"]').clear()
    job_search=driver.find_element_by_xpath('//*[@id="keyword-search-box"]')
    job_search.send_keys('<PASSWORD>')
    
    job_location=driver.find_element_by_xpath('//*[@id="location-search-box"]').clear()
    job_location=driver.find_element_by_xpath('//*[@id="location-search-box"]')
    job_location.send_keys(i)
    
    driver.find_element_by_xpath('//*[@id="content-outlet"]/section[1]/div/div/section/form/div/button').click()
    job_posts.append(driver.find_element_by_xpath('//*[@id="content-outlet"]/div/section[3]/div[2]/div/section[1]/div/div[1]/div/div/strong').text)
    driver.execute_script("window.history.go(-1)")
city_state_sample = city_state[0:29786]
city_state_sample['Job_postings'] = job_posts<jupyter_output><empty_output><jupyter_text>A Dataframe which shows the count of Data Analytics job postings by location<jupyter_code>city_state_sample<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1532258064516129, 'fraction_numerical': 0.010080645161290322, 'mean_word_length': 7.603082851637765, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '597112', 'license': 'MIT', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1602, 'n_words': 236, 'path': 'LinkedIn Web Scrapper.ipynb', 'repo_name': 'keerthana151094/Web_Scrapping', 'size': '4468'}