Untitled
unknown
python
2 years ago
1.7 kB
4
Indexable
import os from selenium import webdriver from googlesearch import search from selenium.webdriver.common.keys import Keys import time from selenium.webdriver.common.by import By from selenium.webdriver.chrome.options import Options from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.service import Service # Add your Google account email and password to ChromeOptions # Create a webdriver instance chrome_options = Options() chrome_options.add_argument("--profile-directory=Profile 8") chrome_options.add_argument('--user-data-dir=/Users/ruchantalhagunay/Library/Application Support/Google/Chrome/') #chrome_options.add_argument("--headless") driver = webdriver.Chrome(options=chrome_options, executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome') driver.get("https://www.deviantart.com/users/login") button = driver.find_element(By.ID, "loginbutton") email_input = driver.find_element(By.ID, "username") email_input.send_keys("ruchan19078") password_input = driver.find_element(By.ID, "password") password_input.send_keys("Daymoon1907") button.click() wait = WebDriverWait(driver, 15) wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="stash-form"]/input[1]'))) upload_input = driver.find_element(By.XPATH, '//*[@id="stash-form"]/input[1]') dir_path = "/Users/ruchantalhagunay/development/selenium/data" file_path = os.path.abspath("data/1613587268776-teytey.jpeg") upload_input.send_keys(file_path) sb_button_2 = driver.find_element(By.XPATH, '//*[@id="ile-contents"]/div[1]/div[2]/span[2]/button') sb_button_2.click()
Editor is loading...