-
Notifications
You must be signed in to change notification settings - Fork 0
/
selenium_BI_project_LinkedinGE.py
68 lines (45 loc) · 2.21 KB
/
selenium_BI_project_LinkedinGE.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
import time
driver=webdriver.Edge(r'C:\Users\hamza\Downloads\edgedriver_win64\msedgedriver.exe')
driver.get('https://graph.linkedin.com/insights/labor-market')
time.sleep(10)
country=driver.find_element(By.ID,"lmiCountrySelect")
countryd=Select(country)
countryd_option=countryd.options
for dcountry in range(0,len(countryd_option)):
countryd.select_by_index(dcountry)
time.sleep(5)
region=driver.find_element(By.ID,"lmiRegionSelect")
regiond=Select(region)
regiond_option=regiond.options
for dregion in range(0,len(regiond_option)):
try :
regiond.select_by_index(dregion)
time.sleep(5)
date=driver.find_element(By.ID,"lmiTimeframeSelect")
datedd=Select(date)
datedd_option=datedd.options
for ddate in range(0,len(datedd_option)):
try:
datedd.select_by_index(ddate)
time.sleep(5)
industry=driver.find_element(By.ID,"lmiIndustrySelect")
industryd=Select(industry)
industryd_option=industryd.options
for dindustry in range(0,len(industryd_option)):
try:
industryd.select_by_index(dindustry)
time.sleep(5)
driver.find_element(By.XPATH,"//*[(@id = 'ember24')]").click()
time.sleep(2)
except:
print("exception in industry index ",dindustry," date ",datedd_option[ddate] ,"region",regiond_option[dregion]," country ",countryd_option[dcountry])
break
except:
print("exception in date index ",ddate," region",regiond_option[dregion]," country ",countryd_option[dcountry])
break
except:
print("exception in region index ",dregion," country ",countryd_option[dcountry])
break