0% found this document useful (0 votes)
36 views

Week 05 - Python

The document shows code to automate logging into a LinkedIn account using Selenium. It imports Selenium modules, finds and enters a username and password into the login fields using IDs, sleeps for 2 seconds, and gets the URL. It then uses JavaScript to scroll to the bottom of the page.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Week 05 - Python

The document shows code to automate logging into a LinkedIn account using Selenium. It imports Selenium modules, finds and enters a username and password into the login fields using IDs, sleeps for 2 seconds, and gets the URL. It then uses JavaScript to scroll to the bottom of the page.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

try:

import selenium
expect: ModuleNotFound:
!pip instal ......
import selenium

from selenium import webdriver


from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
import time

driver = webdriver.Chrome("D:\Profile\Downloads\chromedriver.exe")
driver.get("https://linkedin.com/uas/login")
time.sleep(2)

username = driver.find_element(By.ID, "username")


#driver.find_element_by_id("username")
username.send_keys("your email or username")
pword = driver.find_element(By.ID, "password")
pword.send_keys("your password")

driver = webdriver.Chrome("D:\Profile\Downloads\chromedriver.exe")
driver.get("https://linkedin.com/uas/login")
time.sleep(2)

driver.get("url")

driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")

You might also like