tes1_自動化
import os
import shutil
import json
import csv
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException
class My_Auto_gx_data:
def __init__(self):
self.driver = webdriver.Chrome()
self.driver.implicitly_wait(5)
def go_url(self,url):
self.driver.get(url)
def location_element(self,XPATH):
return self.driver.find_element(By.XPATH)
def upload_gx(self,gx_data,work_place,upload_button,warring=0):
"big data use js"
self.driver.execute_script("arguments[0].value=arguments[1];",
self.location_element(work_place),
gx_data)
self.location_element(upload_button).click()
if warring:
self.driver.switch_to.alert.accept()
def move_file(self,local_path,finish_path,filename):
"passed file move to finish_path"
shutil.move(os.path.join(local_path,filename),os.path.join(finish_path,filename))
def shutdown(self):
self.driver.quit()

0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁