51Testing软件测试论坛
标题:
python内部各模块调用是一个实例
[打印本页]
作者:
liudezheng
时间:
2018-8-9 10:01
标题:
python内部各模块调用是一个实例
main.py
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from public import login
from control import all_Find
from selenium import webdriver
if __name__ == '__main__':
all_Find.find(login.Login(''))
find_doc.py
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from selenium import webdriver
from public import login
import time
def find(browser):
# 多选框
browser.find_elements_by_css_selector('input[type=checkbox]').pop(0).click();
browser.find_elements_by_css_selector('input[type=checkbox]').pop(1).click();
time.sleep(2)
browser.find_element_by_css_selector("option[value='docId']").click();
time.sleep(1)
browser.find_element_by_id("content_id").click();
browser.find_element_by_id("content_id").send_keys(" EDOC1000069491 ");
btn=browser.find_element_by_css_selector("input[class='button ']");
btn.click();
time.sleep(5)
if __name__ == '__main__':
find(login.Login(""))
login.py
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from selenium import webdriver
import time
def Login(self):
browser=webdriver.Chrome()
browser.get("http://10.22.108.199:18088/dmpdata-accessweb/docSearch")
#最大窗口
browser.maximize_window()
#登录
browser.find_element_by_id("uid").send_keys("abc123")
browser.find_element_by_name("password").send_keys("******")
browser.find_element_by_name("Submit").click()
time.sleep(1)
return browser
if __name__ == '__main__':
Login("")
作者:
lsekfe
时间:
2018-8-28 09:38
最好说明下和备注下,不然这个实例很难让人学习。
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2