├── pages ├── __init__.py ├── po_page.py └── pw_page.py ├── test_dir ├── __init__.py ├── sub_test │ ├── __init__.py │ └── test_sample.py ├── .env ├── test_002_link.py ├── test_005_ddt.py ├── test_003_iframe.py ├── test_004_window.py ├── test_007_po.py ├── test_po_pw.py ├── test_ai_se.py ├── test_001_form.py ├── test_ai_pw.py └── test_006_file_ddt.py ├── report.png ├── test_data ├── csv_data.csv ├── excel_data.xlsx ├── yaml_data.yaml └── json_data.json ├── requirements.txt ├── run.py ├── jenkins_run.py ├── README.md ├── confrun.py ├── .gitignore └── LICENSE /pages/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_dir/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_dir/sub_test/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /report.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeldomQA/seldom-web-testing/HEAD/report.png -------------------------------------------------------------------------------- /test_data/csv_data.csv: -------------------------------------------------------------------------------- 1 | firstname,lastname 2 | Forest,Hobbs 3 | Ferdinand,Lozano 4 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | seldom==3.13.0 2 | poium==1.6.3 3 | autowing==0.6.1 4 | playwright==1.51.0 -------------------------------------------------------------------------------- /test_data/excel_data.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SeldomQA/seldom-web-testing/HEAD/test_data/excel_data.xlsx -------------------------------------------------------------------------------- /test_dir/.env: -------------------------------------------------------------------------------- 1 | AUTOWING_MODEL_PROVIDER=qwen 2 | OPENAI_API_KEY=sk-xxx 3 | DEEPSEEK_API_KEY=sk-xxx 4 | DASHSCOPE_API_KEY=sk-xxx 5 | ARK_API_KEY=xxx-xxx-xxx 6 | DOUBAO_MODEL_NAME=ep-xxx -------------------------------------------------------------------------------- /test_data/yaml_data.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: 3 | - - Elnora 4 | - West 5 | - - Leon 6 | - Richard 7 | login: 8 | - username: Tom 9 | password: tom123 10 | - username: Jerry 11 | password: jerry123 -------------------------------------------------------------------------------- /pages/po_page.py: -------------------------------------------------------------------------------- 1 | from poium import Page, Element 2 | 3 | 4 | class BingPage(Page): 5 | """baidu page""" 6 | search_input = Element(id_="sb_form_q") 7 | search_button = Element(tag="svg") 8 | 9 | -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | 3 | 4 | if __name__ == '__main__': 5 | seldom.main( 6 | path="./test_dir", 7 | browser="edge", # edge 8 | rerun=3, 9 | open=False 10 | ) 11 | -------------------------------------------------------------------------------- /pages/pw_page.py: -------------------------------------------------------------------------------- 1 | from poium.playwright import Page, Locator 2 | 3 | 4 | class BingPage(Page): 5 | search_input = Locator('id=sb_form_q', describe="bing搜索框") 6 | search_icon = Locator('id=search_icon', describe="bing搜索按钮") 7 | -------------------------------------------------------------------------------- /test_data/json_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": [ 3 | ["Wayne", "Burch"], 4 | ["Jamie-louise", "Wong"] 5 | ], 6 | "login":[ 7 | { 8 | "username": "Tom", 9 | "password": "tom123" 10 | }, 11 | { 12 | "username": "Jerry", 13 | "password": "jerry123" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /test_dir/sub_test/test_sample.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | 3 | class BingTest(seldom.TestCase): 4 | """ 5 | selector find element 6 | """ 7 | 8 | def test_bing_search(self): 9 | """ 10 | A simple test 11 | """ 12 | self.open("https://cn.bing.com/") 13 | self.type("#sb_form_q", text="seldom") 14 | self.click("tag=svg") 15 | self.assertInTitle("必应") 16 | -------------------------------------------------------------------------------- /jenkins_run.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | from selenium.webdriver import EdgeOptions 3 | 4 | 5 | if __name__ == '__main__': 6 | edge_option = EdgeOptions() 7 | edge_option.add_argument("--headless=new") 8 | browser = { 9 | "browser": "edge", 10 | "options": edge_option 11 | } 12 | seldom.main( 13 | path="./test_dir", 14 | browser=browser, # edge 15 | rerun=3, 16 | open=False 17 | ) 18 | -------------------------------------------------------------------------------- /test_dir/test_002_link.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | 3 | 4 | class LinkTest(seldom.TestCase): 5 | """ 6 | 链接 7 | """ 8 | 9 | def test_link(self): 10 | """ 11 | 测试链接 12 | """ 13 | self.open("https://sahitest.com/demo/linkTest.htm") 14 | self.click_text("linkByContent") 15 | self.sleep(2) 16 | self.click_text("Back") 17 | 18 | 19 | if __name__ == '__main__': 20 | seldom.main(debug=True) 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test_dir/test_005_ddt.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | from seldom import data 3 | 4 | 5 | class DDTTest(seldom.TestCase): 6 | """ 7 | 数据驱动 8 | """ 9 | 10 | @data([ 11 | ('case1', 'seldom'), 12 | ('case2', 'selenium'), 13 | ('case3', 'unittest'), 14 | ]) 15 | def test_bing(self, _, search_key): 16 | """ 17 | data driver 18 | """ 19 | self.open("https://cn.bing.com/") 20 | self.type(id_="sb_form_q", text=search_key, enter=True) 21 | self.assertInTitle(search_key) 22 | 23 | 24 | if __name__ == '__main__': 25 | seldom.main(debug=True) 26 | -------------------------------------------------------------------------------- /test_dir/test_003_iframe.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | 3 | 4 | class IFrameTest(seldom.TestCase): 5 | """ 6 | 嵌套表单 7 | """ 8 | 9 | def test_iframe(self): 10 | """ 11 | 测试嵌套表单 12 | """ 13 | self.open("https://sahitest.com/demo/iframesTest.htm") 14 | self.switch_to_frame(xpath="//iframe") 15 | title = self.get_text(xpath="//h2") 16 | self.assertEqual(title, "Sahi Tests") 17 | self.switch_to_frame_out() 18 | title = self.get_text(xpath="//h2") 19 | self.assertEqual(title, "IFRAME Tests") 20 | 21 | 22 | if __name__ == '__main__': 23 | seldom.main(debug=True) 24 | -------------------------------------------------------------------------------- /test_dir/test_004_window.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | 3 | 4 | class WindowTest(seldom.TestCase): 5 | """ 6 | 多窗口 7 | """ 8 | 9 | def test_window(self): 10 | """ 11 | 测试窗口 12 | """ 13 | self.open("https://sahitest.com/demo/") 14 | # 打开新窗口 15 | self.click_text("Window Open Test") 16 | self.switch_to_window(1) 17 | self.sleep(2) 18 | self.switch_to_window(0) 19 | # 打开新窗口 标题 20 | self.click_text("Window Open Test With Title") 21 | self.switch_to_window(2) 22 | self.sleep(2) 23 | self.assertTitle("With Title") 24 | 25 | 26 | if __name__ == '__main__': 27 | seldom.main(debug=True) 28 | -------------------------------------------------------------------------------- /test_dir/test_007_po.py: -------------------------------------------------------------------------------- 1 | """ 2 | page object model 3 | Using the poium Library 4 | https://github.com/SeldomQA/poium 5 | ``` 6 | > pip install poium 7 | ``` 8 | """ 9 | import seldom 10 | from seldom.utils import file 11 | file.add_to_path(str(file.dir_dir)) 12 | from pages.po_page import BingPage 13 | 14 | 15 | class BingTest(seldom.TestCase): 16 | """ 17 | page object 设计模式 18 | """ 19 | 20 | def test_bing_search(self): 21 | """ 22 | A simple test 23 | """ 24 | page = BingPage() 25 | page.open("https://cn.bing.com/") 26 | page.search_input.send_keys("seldom") 27 | page.search_button.click() 28 | self.assertInTitle("必应") 29 | 30 | 31 | if __name__ == '__main__': 32 | seldom.main(browser='chrome', debug=True) 33 | -------------------------------------------------------------------------------- /test_dir/test_po_pw.py: -------------------------------------------------------------------------------- 1 | """ 2 | page object model 3 | Using the poium Library 4 | https://github.com/SeldomQA/poium 5 | ``` 6 | > pip install poium 7 | ``` 8 | """ 9 | import seldom 10 | from seldom.utils import file 11 | file.add_to_path(str(file.dir_dir)) 12 | from pages.pw_page import BingPage 13 | from playwright.sync_api import sync_playwright 14 | from playwright.sync_api import expect 15 | 16 | 17 | class BingTest(seldom.TestCase): 18 | """ 19 | page object 设计模式 20 | """ 21 | def start(self): 22 | self.p = sync_playwright().start() 23 | self.chromium = self.p.chromium.launch(headless=False) 24 | self.page = self.chromium.new_page() 25 | 26 | def end(self): 27 | self.chromium.close() 28 | self.p.stop() 29 | 30 | def test_bing_search(self): 31 | """ 32 | A simple test 33 | """ 34 | self.page.goto("https://cn.bing.com/") 35 | bp = BingPage(self.page) 36 | bp.search_input.highlight() 37 | bp.search_input.fill("playwright") 38 | bp.search_icon.highlight() 39 | bp.search_icon.click() 40 | expect(self.page).to_have_title("playwright - 搜索") 41 | 42 | 43 | if __name__ == '__main__': 44 | seldom.main() 45 | -------------------------------------------------------------------------------- /test_dir/test_ai_se.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unittest example for Selenium with AI automation. 3 | """ 4 | import seldom 5 | from autowing.selenium.fixture import create_fixture 6 | from seldom import Seldom 7 | from dotenv import load_dotenv 8 | 9 | 10 | class TestBingSearch(seldom.TestCase): 11 | 12 | @classmethod 13 | def start_class(cls): 14 | # loading .env file 15 | load_dotenv() 16 | # Create AI fixture 17 | ai_fixture = create_fixture() 18 | cls.ai = ai_fixture(Seldom.driver) 19 | 20 | def test_01_bing_search(self): 21 | """ 22 | Test Bing search functionality using AI-driven automation. 23 | This test demonstrates: 24 | 1. Navigating to Bing 25 | 2. Performing a search 26 | 3. Verifying search results 27 | """ 28 | self.open("https://cn.bing.com") 29 | 30 | self.ai.ai_action('搜索输入框输入"playwright"关键字,并回车') 31 | self.sleep(3) 32 | 33 | items = self.ai.ai_query('string[], 搜索结果列表中包含"playwright"相关的标题') 34 | 35 | self.assertGreater(len(items), 1) 36 | 37 | self.assertTrue( 38 | self.ai.ai_assert('检查搜索结果列表第一条标题是否包含"playwright"字符串') 39 | ) 40 | 41 | 42 | if __name__ == '__main__': 43 | seldom.main(browser="edge", debug=True) 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # seldom-web-testing 2 | 3 | > seldom Web 自动化测试项目. 4 | 5 | ## 安装 6 | 7 | ```shell 8 | > git clone https://github.com/SeldomQA/seldom-web-testing 9 | > cd seldom-web-testing 10 | > pip install -r requirements.txt 11 | ``` 12 | 13 | ## 运行 14 | 15 | 目录结构: 16 | 17 | ```shell 18 | mypro/ 19 | ├── pages/ 20 | │ ├── xxx_page.py 21 | ├── reports/ 22 | ├── test_data/ 23 | │ ├── xx_data.json 24 | ├── test_dir/ 25 | │ ├── test_xxx_xxx.py 26 | └── run.py 27 | ``` 28 | 29 | * `pages/` page层封装目录。 30 | * `reports/` 测试报告目录。 31 | * `test_data/` 测试数据目录。 32 | * `test_dir/` 测试用例目录。 33 | * `run.py` 运行测试用例主文件。 34 | 35 | 运行用例: 36 | 37 | * `seldom` 命令,使用`confrun.py` 文件配置。 38 | 39 | ```shell 40 | # 指定测试目录 41 | > seldom --path test_dir 42 | # 指定文件(`/` 反斜杠) 43 | > seldom --path test_dir/test_001_form.py 44 | 45 | # 指定测试类 46 | > seldom --mod test_dir.test_001_form.FormTest 47 | # 指定测试方法 48 | > seldom --mod test_dir.test_001_form.FormTest.test_from 49 | ``` 50 | 51 | * `seldom.main()` 方法 52 | 53 | ```python 54 | # run.py 55 | import seldom 56 | 57 | 58 | if __name__ == '__main__': 59 | seldom.main( 60 | path="./test_dir", # 运行目录 61 | browser="gc", # 浏览器 62 | rerun=3, # 重跑次数 63 | ) 64 | ``` 65 | 66 | ```shell 67 | > python run.py 68 | ``` 69 | 70 | ## 测试报告 71 | 72 | ![](report.png) 73 | -------------------------------------------------------------------------------- /test_dir/test_001_form.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | 3 | 4 | class FormTest(seldom.TestCase): 5 | """ 6 | 表单 7 | """ 8 | 9 | def test_from(self): 10 | """ 11 | 测试表单 12 | """ 13 | self.open("https://sahitest.com/demo/formTest.htm") 14 | # 警告框 15 | self.alert.accept() 16 | # 输入框 17 | self.type(name="t1", text="input1") 18 | self.type(xpath="/html/body/form/table/tbody/tr[3]/td[2]/input", text="input2") 19 | self.type(name="name", text="input3") 20 | self.type(css="[name$=a_dollar]", text="input4") 21 | self.type(name="ta1", text="hello world\n") 22 | # 复选框 23 | self.click(css="[value=cv1]") 24 | self.click(css="[value=cv2]") 25 | self.click(css="[value=cv3]") 26 | self.click(css="[type=checkbox]", index=3) 27 | # 单选框 28 | self.click(name="r1") 29 | self.click(name="r1", index=1) 30 | # 密码框 31 | self.type(xpath="//*[@type='password']", index=0, text="123") 32 | self.type(xpath="//*[@type='password']", index=1, text="456") 33 | self.window_scroll(height=800) 34 | self.sleep(2) 35 | # 下拉选择框 36 | self.select(name="s1", value="o2") 37 | self.alert.accept() 38 | self.select(name="s1", text="o3") 39 | self.alert.accept() 40 | self.select(name="s1", index=1) 41 | self.alert.accept() 42 | 43 | 44 | if __name__ == '__main__': 45 | seldom.main(debug=True) 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /confrun.py: -------------------------------------------------------------------------------- 1 | """ 2 | seldom confrun.py hooks function 3 | """ 4 | 5 | 6 | def start_run(): 7 | """ 8 | Test the hook function before running 9 | """ 10 | ... 11 | 12 | 13 | def end_run(): 14 | """ 15 | Test the hook function after running 16 | """ 17 | ... 18 | 19 | 20 | def browser(): 21 | """ 22 | Web UI test: 23 | browser: gc(google chrome)/ff(firefox)/edge/ie/safari 24 | """ 25 | return "edge" 26 | 27 | 28 | def debug(): 29 | """ 30 | debug mod True/False 31 | """ 32 | return False 33 | 34 | 35 | def rerun(): 36 | """ 37 | error/failure rerun times 38 | """ 39 | return 0 40 | 41 | 42 | def report(): 43 | """ 44 | setting report path 45 | Used: 46 | return "d://mypro/result.html" 47 | return "d://mypro/result.xml" 48 | """ 49 | return None 50 | 51 | 52 | def timeout(): 53 | """ 54 | setting timeout 55 | """ 56 | return 10 57 | 58 | 59 | def title(): 60 | """ 61 | setting report title 62 | """ 63 | return "seldom test report" 64 | 65 | 66 | def tester(): 67 | """ 68 | setting report tester 69 | """ 70 | return "bugmaster" 71 | 72 | 73 | def description(): 74 | """ 75 | setting report description 76 | """ 77 | return ["windows", "jenkins"] 78 | 79 | 80 | def language(): 81 | """ 82 | setting report language 83 | return "en" 84 | return "zh-CN" 85 | """ 86 | return "en" 87 | 88 | 89 | def whitelist(): 90 | """test label white list""" 91 | return [] 92 | 93 | 94 | def blacklist(): 95 | """test label black list""" 96 | return [] 97 | -------------------------------------------------------------------------------- /test_dir/test_ai_pw.py: -------------------------------------------------------------------------------- 1 | """ 2 | Unittest example for Playwright with AI automation. 3 | """ 4 | import seldom 5 | from playwright.sync_api import sync_playwright 6 | from autowing.playwright.fixture import create_fixture 7 | from dotenv import load_dotenv 8 | 9 | 10 | class TestBingSearch(seldom.TestCase): 11 | 12 | @classmethod 13 | def start_class(cls): 14 | # loading .env file 15 | load_dotenv() 16 | # Initialize browser 17 | cls.playwright = sync_playwright().start() 18 | cls.browser = cls.playwright.chromium.launch(headless=False) 19 | cls.context = cls.browser.new_context() 20 | cls.page = cls.context.new_page() 21 | # Create AI fixture 22 | ai_fixture = create_fixture() 23 | cls.ai = ai_fixture(cls.page) 24 | 25 | @classmethod 26 | def end_class(cls): 27 | cls.context.close() 28 | cls.browser.close() 29 | cls.playwright.stop() 30 | 31 | def test_01_bing_search(self): 32 | """ 33 | Test Bing search functionality using AI-driven automation. 34 | This test demonstrates: 35 | 1. Navigating to Bing 36 | 2. Performing a search 37 | 3. Verifying search results 38 | """ 39 | self.page.goto("https://cn.bing.com") 40 | 41 | self.ai.ai_action('搜索输入框输入"playwright"关键字,并回车') 42 | self.page.wait_for_timeout(3000) 43 | 44 | items = self.ai.ai_query('string[], 搜索结果列表中包含"playwright"相关的标题') 45 | 46 | self.assertGreater(len(items), 1) 47 | 48 | self.assertTrue( 49 | self.ai.ai_assert('检查搜索结果列表第一条标题是否包含"playwright"字符串') 50 | ) 51 | 52 | 53 | if __name__ == '__main__': 54 | seldom.main() 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | -------------------------------------------------------------------------------- /test_dir/test_006_file_ddt.py: -------------------------------------------------------------------------------- 1 | import seldom 2 | from seldom import file_data 3 | 4 | 5 | class FileDataTest(seldom.TestCase): 6 | """ 7 | 文件数据驱动 8 | """ 9 | 10 | def start(self): 11 | self.test_url = "https://www.w3school.com.cn/tiy/t.asp?f=eg_html_form_submit" 12 | 13 | @file_data("json_data.json", key="name") 14 | def test_json_list(self, firstname, lastname): 15 | """ 16 | used file_data test 17 | """ 18 | self.open(self.test_url) 19 | self.switch_to_frame(id_="iframeResult") 20 | self.type(name="firstname", text=firstname, clear=True) 21 | self.type(name="lastname", text=lastname, clear=True) 22 | self.sleep() 23 | 24 | @file_data("json_data.json", key="login") 25 | def test_json_dict(self, _, username, password): 26 | """ 27 | used file_data test 28 | """ 29 | self.open(self.test_url) 30 | self.switch_to_frame(id_="iframeResult") 31 | self.type(name="firstname", text=username, clear=True) 32 | self.type(name="lastname", text=password, clear=True) 33 | self.sleep() 34 | 35 | @file_data("yaml_data.yaml", key="name") 36 | def test_yaml_list(self, firstname, lastname): 37 | """ 38 | used file_data test 39 | """ 40 | self.open(self.test_url) 41 | self.switch_to_frame(id_="iframeResult") 42 | self.type(name="firstname", text=firstname, clear=True) 43 | self.type(name="lastname", text=lastname, clear=True) 44 | self.sleep() 45 | 46 | @file_data("yaml_data.yaml", key="login") 47 | def test_yaml_list(self, username, password): 48 | """ 49 | used file_data test 50 | """ 51 | self.open(self.test_url) 52 | self.switch_to_frame(id_="iframeResult") 53 | self.type(name="firstname", text=username, clear=True) 54 | self.type(name="lastname", text=password, clear=True) 55 | self.sleep() 56 | 57 | @file_data("csv_data.csv", line=2) 58 | def test_csv(self, firstname, lastname): 59 | """ 60 | used file_data test 61 | """ 62 | self.open(self.test_url) 63 | self.switch_to_frame(id_="iframeResult") 64 | self.type(name="firstname", text=firstname, clear=True) 65 | self.type(name="lastname", text=lastname, clear=True) 66 | self.sleep() 67 | 68 | @file_data(file="excel_data.xlsx", sheet="Sheet1", line=2) 69 | def test_excel(self, firstname, lastname): 70 | """ 71 | used file_data test 72 | """ 73 | self.open(self.test_url) 74 | self.switch_to_frame(id_="iframeResult") 75 | self.type(name="firstname", text=firstname, clear=True) 76 | self.type(name="lastname", text=lastname, clear=True) 77 | self.sleep() 78 | 79 | 80 | if __name__ == '__main__': 81 | seldom.main(debug=True) 82 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------