發表文章

目前顯示的是 3月, 2020的文章

python - auto Check in to work

a python program for auto check in to work on web site selenium need other browser driver # -*- coding: utf-8 -*- import time import random from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome() # Optional argument, if not specified will search path. driver.get( 'company url' ) # random time login(10s-30min time.sleep(random.randint( 10 , 1800 )) # Let the user actually see something! try : # find xpath of account & password driver.find_element_by_xpath( "//*[@id='userid_input']" ).send_keys( "account" ) driver.find_element_by_xpath( "//*[@id='password']" ).send_keys( "password" ) # click login button driver.find_element_by_xpath( "/html/body/form/table[2]/tbody/tr/td[2]/table/tbody/tr[3]/td[2]/div/a/img" ).click() time.sleep( 5 ) # click login page driver.find_element_by_link_text( " 今日出勤班別 " ).click() time.sl