import
time
from
selenium
import
webdriver
from
selenium.webdriver.common.alert
import
Alert
driver
=
webdriver.Chrome()
driver.get(
'https://gitee.com/login'
)
driver.maximize_window()
time.sleep(
2
)
user_login
=
driver.find_element_by_id(
'user_login'
)
user_login.send_keys(
"此处改为你的账号"
)
driver.find_element_by_id(
'user_password'
).send_keys(
"此处改为你的密码"
)
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
)
driver.get(
'https://gitee.com/此处改为you_gitee_id/此处改为you_gitee_id/pages'
)
driver.find_element_by_xpath(
'/html/body/div[3]/div[2]/div/div[2]/div[1]/form/div[7]'
).click()
Alert(driver).accept()
time.sleep(
5
)
print
(
"成功"
)
driver.quit()
fp
=
open
(
"D:\log.txt"
,
"a+"
)
now_time
=
time.strftime(
"%Y-%m-%d %H:%M:%S"
, time.localtime())
fp.write(
"auto update time:{0}\n"
.
format
(now_time))
fp.close()