from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(r"C:\Users\chintu\PycharmProjects\FirstSeleniumTest\drivers\chromedriver.exe")

driver.set_page_load_timeout(30)
driver.get("https://www.google.com/ ")
driver.find_element_by_name("q").send_keys("Linkedin")
driver.maximize_window()
driver.find_element_by_name("btnK").send_keys(Keys.ENTER)
time.sleep(2)
elem1=driver.find_element_by_class_name("LC20lb")
elem1.click()
time.sleep(2)
elem2=driver.find_element_by_class_name("nav__button-secondary")
elem2.click()
elem3=driver.find_element_by_name("session_key")
elem3.click()
driver.find_element_by_name("session_key").send_keys("chaitanyavsml@gmail.com")
driver.find_element_by_name("session_password").send_keys("Pranita15")

e1=driver.find_element_by_xpath("/html/body/div/main/div/form/div[3]/button")
e1.click()
time.sleep(3)
e2=driver.find_element_by_xpath("/html/body/div[5]/div[5]/div[3]/div/div/div/div/div[1]/div/div[1]/button[1]")
e2.click()
time.sleep(3)
driver.find_element_by_xpath("/html/body/div[5]/div[5]/div[3]/div/div/div/div/div[1]/div[2]/div/div[1]/div[3]/div/div/div[1]").send_keys(" Automation Testing generated text ")
e3=driver.find_element_by_xpath("/html/body/div[5]/div[5]/div[3]/div/div/div/div/div[1]/div[2]/div/div[1]/div[2]/button/span")
e3.click()
time.sleep(4)
e4=driver.find_element_by_xpath("/html/body/div[5]/div[5]/div[3]/div/div/div/div/div[1]/div[2]/div/div[1]/fieldset/ul/li[3]/button/div")
e4.click()
e5=driver.find_element_by_xpath("/html/body/div[5]/div[5]/div[3]/div/div/div/div/div[1]/div[2]/div/div[2]/div/button/span")
e5.click()
e6=driver.find_element_by_xpath("/html/body/div[5]/div[5]/div[3]/div/div/div/div/div[1]/div[2]/div/div[2]/div[2]/button/span")
e6.click()
time.sleep(3)
#post successfully

a3=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[2]/a/span[2]")
a3.click()
time.sleep(3)
a1=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[3]/a/span[1]")
a1.click()
time.sleep(3)
a2=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[4]/a/span[1]")
a2.click()
time.sleep(3)
a4=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[5]/a/span[1]")
a4.click()
time.sleep(3)
a5=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[6]/div/div/button/div/span")
a5.click()
time.sleep(4)
a6=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[6]/div/div/ul/li[1]/a/div[2]/span")
a6.click()
time.sleep(3)
a5.click()
time.sleep(4)
a7=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[6]/div/div/ul/li[4]/ul/li[1]/a")
a7.click()
time.sleep(3)
w1=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[7]/div/div/button/li-icon")
w1.click()
time.sleep(3)
w2=driver.find_element_by_xpath("/html/body/div[4]/div/div/button")
w2.click()




a5.click()
time.sleep(4)
#a8=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[6]/div/div/ul/li[4]/ul/li[2]/a")
#a8.click()
driver.get("https://www.linkedin.com/talent/post-a-job?trk=nav_account_sub_nav_job_lmore")


time.sleep(3)
driver.find_element_by_class_name("ts-common-typeahead__input").send_keys("Chaitanya pvt ltd")
driver.find_element_by_id("typeahead-input-ember42").send_keys("web developer")
#driver.find_element_by_xpath("").send_keys("Pune")
time.sleep(3)
#q1=driver.find_element_by_class_name("ts-nav-user-menu__profile-photo lazy-image loaded ember-view")
#q1.click()
driver.get("https://www.linkedin.com/feed/")
time.sleep(3)
aa1=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[6]/div/div/button/img")
aa1.click()
driver.get("https://www.linkedin.com/psettings/select-language")
time.sleep(3)
driver.get("https://www.linkedin.com/psettings/account")

z1=driver.find_element_by_xpath("/html/body/div/main/div[2]/div/div/ul/li[4]/a/h3")
z1.click()
driver.get("https://www.linkedin.com/psettings/change-password")
driver.find_element_by_xpath("/html/body/div/main/div[2]/div/div/ul/li[4]/div/div/form/fieldset[1]/input").send_keys("Pranita15")
driver.find_element_by_xpath("/html/body/div/main/div[2]/div/div/ul/li[4]/div/div/form/fieldset[1]/div[2]/input").send_keys("Pranita15")
driver.find_element_by_xpath("/html/body/div/main/div[2]/div/div/ul/li[4]/div/div/form/fieldset[1]/div[4]/input").send_keys("Pranita15")
z2=driver.find_element_by_xpath("/html/body/div/main/div[2]/div/div/ul/li[4]/div/div/form/div/button")
z2.click()
time.sleep(3)
z3=driver.find_element_by_xpath("/html/body/div/header/div[2]/div/div/nav/ul/li[1]/a")
z3.click()
time.sleep(3)
#z4=driver.find_element_by_xpath("/html/body/div[5]/div[5]/aside/div/header/section[2]/artdeco-dropdown/artdeco-dropdown-trigger")
#z4.click()
#time.sleep(3)
#z6=driver.find_element_by_class_name("ember-view")
#z6.click()
#z7=driver.find_element_by_xpath("/html/body/div[4]/div/div/button/li-icon/svg")
#z7.click()
z8=driver.find_element_by_class_name("small-icon")
z8.click()
z9=driver.find_element_by_xpath("/html/body/header/div/nav/ul/li[6]/div/div/ul/li[5]/ul/li/a")
z9.click()
#driver.find_element_by_xpath("/html/body/div[5]/div[5]/aside/div[2]/div[1]/div[2]/section/div/input").send_keys("chaitanya")
#driver.find_element_by_xpath("/html/body/div[5]/div[5]/aside/div[2]/div[1]/form/div[3]/div/div[1]/div[1]/p").send_keys("hello")
#z5=driver.find_element_by_xpath("/html/body/div[5]/div[5]/aside/div[1]/header/section[2]/artdeco-dropdown/div/artdeco-dropdown-content/ul/artdeco-dropdown-item[2]")
#z5.click()
time.sleep(4)
driver.quit()
print("Test is completed successfully")
