from selenium import webdriver
import os
import time
# 打开浏览器
driver=webdriver.Firefox()
driver.get('http://127.0.0.1:8080/BabyPlan/login.jsp')

#登录
driver.find_element_by_id('userName').send_keys('user')
driver.find_element_by_id('password').send_keys('user11')
driver.find_element_by_id('loginbtn').click()

#进入爸妈天地
driver.find_element_by_link_text('爸妈天地').click()
driver.find_element_by_link_text("照片列表").click()


#上传照片
driver.find_element_by_id('photobtn').click()
time.sleep(2)
driver.find_element_by_id("txtPhotoImg").click()
#调用zz.exe可执行程序
# os.system('F:\\upload.exe')
#上传图片

for i in range(3):        driver.find_element_by_xpath('/html/body/div[3]/div[2]/form/div/div/div/div[2]/button[1]').click()
        file_path = "D:\\%s.png"%i
        os.system("F:\\upload.exe%s" %file_path)
# if driver.find_element_by_xpath('/html/body/div[3]/div[2]/form/div/div/div/div[2]/button[1]').click():
      print('图片上传成功!')
else:
     print('图片上传失败')
driver.quit()

   


#autoit中的脚本文件

#脚本文件代码
WinWait("CLASS:#32770","",5)
ControlFocus("文件上传", "", "Edit1")
WinWait("[CLASS:#32770]", "", 10)
ControlSetText("文件上传" ,"", "Edit1",$CmdLine[1])
Sleep(2000)
ControlClick("文件上传", "","Button1");


  •    2019-08-04 00:17:45
  • 阅读 1108    收藏 0    回答 1
  • 收藏
  • 分享
发送
登录 后发表评论
发送
此问答将在内关闭,或在双方输入50次回复后关闭...
  • 51testing软件测试圈微信