python_apps/selenium/main.py
2023-11-03 14:49:12 +09:00

60 lines
2.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 샘플 Python 스크립트입니다.
# ⌃R을(를) 눌러 실행하거나 내 코드로 바꿉니다.
# 클래스, 파일, 도구 창, 액션 및 설정을 어디서나 검색하려면 ⇧ 두 번을(를) 누릅니다.
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
# 스크립트를 실행하려면 여백의 녹색 버튼을 누릅니다.
if __name__ == '__main__':
url = "https://app.swit.io/auth/login?redirect=https%253A%252F%252Fapp.swit.io%252Fskbpartner&subdomain=skbpartner"
url2 = "https://app.swit.io/digital-innovation/project/alltask?task_filter_query=%257B%2522status_id%2522%253A%2522%2522%252C%2522tag%2522%253A%2522%2522%252C%2522color%2522%253A%2522%2522%252C%2522priority%2522%253A%2522%2522%252C%2522assignee%2522%253A%2522%2522%252C%2522project%2522%253A%2522%2522%252C%2522date%2522%253A%2522%2522%252C%2522due_type%2522%253A%2522%2522%252C%2522search_txt%2522%253A%2522%2522%252C%2522filterId%2522%253A%2522%2522%252C%2522target%2522%253A0%252C%2522order%2522%253A0%252C%2522subtask%2522%253A%2522%2522%252C%2522custom_field%2522%253A%2522%2522%257D"
driver = webdriver.Safari()
driver.get(url2)
driver.find_element(By.CLASS_NAME, 'advanced-sign-button').click()
wait = WebDriverWait(driver, 5)
driver.find_element(By.ID, 'companyUrl').send_keys('skbpartner')
driver.find_element(By.CLASS_NAME, 'button').click()
wait = WebDriverWait(driver, 5)
driver.find_element(By.ID,'id').send_keys('yongseong.kim@ucomp.co.kr')
driver.find_element(By.ID,'password').send_keys('Q!w2e3r4t5')
#
#driver.find_element(By.CLASS_NAME, 'button--large').click()
#driver.implicitly_wait(3)
#elements = driver.find_elements(By.CLASS_NAME, 'all-task-list-item')
#data = [element.text for element in elements]
#print(data)
#html = driver.page_source
#bs = BeautifulSoup(html, 'html.parser')
#print(bs)
#
#
#lements = driver.find_elements(By.XPATH, xpath)
#data = [element.text for element in elements]
#print(data)
# html_comments = driver.find_elements(By.CLASS_NAME, "all-task-list-item")
# print(html_comments)
driver.quit()
# https://www.jetbrains.com/help/pycharm/에서 PyCharm 도움말 참조
#단일 element에 접근
#driver.find_element_by_name('name')
#driver.find_element_by_id('id')
#driver.find_element_by_xpath('/html/body/xpath')
#여러 elements에 접근
#driver.find_element(By.XPATH, " ")
#driver.find_elements(By.XPATH, " ")
#driver.find_element(By.CLASS_NAME, " ")
#driver.find_elements(By.CLASS_NAME, " ")
#find_element(By.NAME, name)