我正在尝试在任务调度程序中进行调度:
一切正常,除了在命令提示符关闭时 python.exe 窗口将保持打开状态。
我的批处理文件:(睡眠是为了运行python代码。需要几秒钟)
call activate python2
start C:\Users\Chris\Anaconda3\envs\python2\python.exe testtest.py
sleep 30
exit
Run Code Online (Sandbox Code Playgroud)
我的python脚本:
driver = webdriver.Chrome(executable_path="C:\path\to\chromedriver")
driver.get('http://website.com')
# Find email and pw fields and then fill them in
email = driver.find_element_by_id("user_email")
email.send_keys('myemail@email.com')
pw = driver.find_element_by_id("user_password")
pw.send_keys('password')
# Click on sign-in button
driver.find_element_by_class_name("button").click()
time.sleep(5)
# Click on save button to update
driver.find_element_by_class_name("button").click()
# Close driver
driver.close()
Run Code Online (Sandbox Code Playgroud)
最后一件事,程序/脚本是批处理文件,没有参数,并且开始在批处理文件所在的目录中。
任何帮助,将不胜感激!