Work small script-upload app to server via plugin

Source: Internet
Author: User

From selenium import Webdriver
From time import sleep
Import OS

Driver = Webdriver. Firefox ()
Driver.get ("xxx")
Driver.find_element_by_name (' account '). Send_keys (' xxx ')
Driver.find_element_by_name (' pwd '). Send_keys (' xxx ')
Sleep (5)
driver.find_element_by_id (' login-btn '). Click ()
Sleep (2)


#遍历整个文件夹并把所有文件路径放到FileList里面

Filelist=[]
Os.chdir (("D:\\app"))
A=os.listdir ("D:\\app")
For I in A:
X=os.path.join ("D:\\app", i)
Filelist.append (x)

For M in FileList:
Driver.find_element_by_link_text (' Security Management '). Click ()
Sleep (0.3)
# Click Application Management
Driver.find_element_by_xpath ('/html/body/div/nav/div[2]/div[1]/ul/li[4]/ul/li[1]/a '). Click ()
Sleep (0.3)

XP = Driver.find_element_by_xpath ("//div[@id = ' content-main ']/iframe")
Driver.switch_to.frame (XP)
Sleep (0.3)
Driver.find_element_by_link_text (' App Review '). Click ()

#切换表单
XP = Driver.find_element_by_xpath ("//iframe[@id = ' control-frame ']")

Driver.switch_to.frame (XP)
Sleep (0.3)
driver.find_element_by_id (' Btn-add '). Click ()
Sleep (0.3)
driver.find_element_by_id (' Apk-upload '). Send_keys (M)
Sleep (1)
#点击上传
Driver.find_element_by_xpath ('/html/body/div[3]/div/div/div[2]/div/div/div/div/form/div[1]/div[1]/div[1]/div[2 ]/div[2]/a/span '). Click ()
Sleep (0.3)
#点击选择类别
Driver.find_element_by_xpath ('/html/body/div[3]/div/div/div[2]/div/div/div/div/form/div[2]/div[2]/span/div/ Button '). Click ()
Driver.find_element_by_xpath ('/html/body/div[3]/div/div/div[2]/div/div/div/div/form/div[2]/div[2]/span/div/ul/ Li[1]/a/label/input '). Click ()
Sleep (0.3)
driver.find_element_by_id (' Btn-save '). Click ()
#刷新
Driver.refresh ()

Work small script-upload app to server via plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.