Gitee 를 사용 하여 python 스 크 립 트 를 자동화 배치 하 는 상세 한 과정
1.1 설치 환경
1.python 3 설치
2、명령 줄 을 열 고 selenium 설치
pip install selenium
2.python 코드2.1 소스 코드
#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
from selenium import webdriver
from selenium.webdriver.common.alert import Alert
# gitee
driver = webdriver.Chrome()
driver.get('https://gitee.com/login')
#
driver.maximize_window()
time.sleep(2)
# -- html id --
user_login = driver.find_element_by_id('user_login')
user_login.send_keys(" ")
# -- html id --
driver.find_element_by_id('user_password').send_keys(" ")
# -- xpath
driver.find_element_by_xpath(
'/html/body/div[2]/div[2]/div[1]/div/div[2]/div/form[1]/div[2]/div/div/div[4]/input').click()
time.sleep(2)
# gitee pages -- you_gitee_id
driver.get('https://gitee.com/ you_gitee_id/ you_gitee_id/pages')
# -- xpath
driver.find_element_by_xpath('/html/body/div[3]/div[2]/div/div[2]/div[1]/form/div[7]').click()
# --
Alert(driver).accept()
# 5
time.sleep(5)
# print , , try
print(" ")
# ,
driver.quit()
#
# D ,
fp = open("D:\log.txt", "a+")
now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
fp.write("auto update time:{0}
".format(now_time))
fp.close()
2.2 주의사항xpath 는 chrom 홈 페이지 에서 F12 를 누 르 면 볼 수 있 습 니 다.
시연 과정
chromeDrive 실행 가능 한 드라이버 를 python 루트 디 렉 터 리 에 버 려 야 합 니 다(python.exe 와 함께 놓 으 십시오)
다운로드 주소
http://chromedriver.storage.googleapis.com/index.html
이상 은 Gitee 를 사용 하여 python 스 크 립 트 를 자동화 배치 하 는 상세 한 과정 입 니 다.Gitee 자동 배치 python 에 관 한 자 료 는 다른 관련 글 을 주목 하 십시오!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
코드 클 라 우 드 웹 훅 2 분기 (master/develop) 자동 배치 생산 복/테스트 복셸 이 '/sbin/nologin' 인 것 을 발견 하려 면 '/bin/bash' 로 바 꿔 야 ww 로그 인 vim/etc/passwd 수정 이 끝 난 후에 저장 su www cd ~/.ssh rm -rf ./* ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.