zoukankan      html  css  js  c++  java
  • 第二个脚本..

    #coding=utf-8
    from selenium import webdriver
    import time
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.support.select import Select
    driver = webdriver.Firefox()
    driver.get('http://58.215.9.181/users/sign_in.html')
    #采购人登陆
    A = driver.find_element_by_id
    A('user_login').send_keys('******')
    A('user_password').send_keys('*****',Keys.ENTER)#登陆成功
    #点击后台管理
    time.sleep(2)
    driver.find_element_by_xpath("//a[@class='bue']").click()
    driver.find_element_by_id('tree_4_span').click()
    driver.switch_to.frame('75')
    time.sleep(4)
    driver.find_element_by_link_text('新增').click()
    driver.find_element_by_id('plan_name').send_keys('ceshi')
    a = driver.find_element_by_xpath("//select[@id='plan_zb_way']")
    Select(a).select_by_value('auction')
    b = driver.find_element_by_xpath("//select[@id='plan_fk_way']")
    Select(b).select_by_value('gkjzzf')
    c = driver.find_element_by_xpath("//select[@id='plan_wtjg']")
    Select(c).select_by_value('zxcg')
    e= driver.find_element_by_xpath("//select[@id='plan_cgxs']")
    Select(e).select_by_value('auction')
    f= driver.find_element_by_xpath("//select[@id='plan_zjly']")
    Select(f).select_by_value('czzj')
    #采购明细
    driver.find_element_by_xpath("//*[@class='btn btn-small btn-primary add_nested_fields']").click()
    print'ok'

    driver.find_element_by_xpath(".//input[contains(@name,'][name]')]").send_keys(u'测试')

    driver.find_element_by_xpath(".//input[contains(@id,'xy_catalog_id_')]").click()
    time.sleep(1)
    driver.find_element_by_link_text('台式电脑').click()
    driver.find_element_by_xpath(".//input[contains(@name,'][unit]')]").send_keys(u'台')#计量单位
    driver.find_element_by_xpath(".//input[contains(@name,'][num]')]").send_keys('11')#数量
    driver.find_element_by_xpath(".//input[contains(@name,'][price]')]").send_keys(6500)#单价

    driver.find_element_by_xpath(".//textarea[contains(@name,'][money_from]')]").send_keys(u'技术参数配置随便')
    driver.find_element_by_xpath(".//textarea[contains(@name,'][remark]')]").send_keys(u'商务要求')

    driver.find_element_by_xpath("//input[@class='button btn btn-primary btn-small mt10 w50']").click()
    time.sleep(1)
    driver.find_element_by_xpath("/html/body/div/table/tbody/tr[2]/td[8]/div/button").click()
    time.sleep(0.5)
    driver.find_element_by_xpath("/html/body/div/table/tbody/tr[2]/td[8]/div/ul/li[5]/a").click()
    time.sleep(1)
    driver.switch_to.alert.accept()
    driver.quit()

    #调用采购人审核模块
    import os
    os.system("python C:UsersAdministratorPycharmProjectsceshicgksh.py")
  • 相关阅读:
    Elasticsearch 6.x版本全文检索学习之数据建模
    Elasticsearch 6.x版本全文检索学习之集群调优建议
    Elasticsearch 6.x版本全文检索学习之聚合分析入门
    SpringCloud的入门学习之Eureka(高可用注册中心HA)构建Provider服务、Consumer服务
    SpringCloud的入门学习之Netflix-eureka(Eureka的集群版搭建)
    Elasticsearch 6.x版本全文检索学习之Search的运行机制
    ERP入门
    NoSQL数据库介绍
    傅立叶变换的物理意义
    电容的基础知识
  • 原文地址:https://www.cnblogs.com/linguowei/p/7346969.html
Copyright © 2011-2022 走看看