-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
65 lines (43 loc) · 1.89 KB
/
main.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
from selenium import webdriver
import pandas as pd
var = webdriver.Chrome(executable_path="C:\\Users\\shivm\\PycharmProjects\\pythonProject\\pythonProject3\\chromedriver.exe")
df = pd.read_csv("autolinkdin.csv", encoding="utf-8")
myuser = df.username[0]
mypass = df.password[0]
mypost = df.posts[0]
print(mypost)
var.get("https://www.linkedin.com/login?")
##############################################################
#locate user from id#
#user = var.find_element_by_id("username")
#locate user bfrom by_name#
user = var.find_element_by_name("session_key")
user.send_keys(myuser)
############################################################
#locate pass from id#
#pwd = var.find_element_by_id("password")
#locate pass from by_name#
pwd = var.find_element_by_name("session_password")
pwd.send_keys(mypass)
#############################################################
#locate submit button from x_path#
#log_in_button = var.find_element_by_xpath("//*[@type='submit']")
#locate submit button by_class_name#
log_in_button = var.find_element_by_class_name("btn__primary--large")
log_in_button.click()
##################################################################
# List of user, pass, post #
myuser = ["[email protected]"]
mypass = ["abcpass"]
mypost = ["hello everyone,"
"this is a automation linkdin project using selenium and chrome web driver"]
# dictionary of the lists #
dict = {"username":myuser, "password":mypass, "posts":mypost}
df = pd.DataFrame(dict)
# saving the dataframe #
df.to_csv("autolinkdin.csv",index=False)
#######################################################################################
post_button = var.find_element_by_id("ember808")
post_button.click()
#make_post = var.find_element_by_xpath('/html/body/div[3]/div/div/div[2]/div/div/div[1]/div[2]/div/div/div[2]/div/div/div[1]')
#make_post.send_keys(mypost)