Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
selenium
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢非
selenium
Commits
2a2acf8e
Commit
2a2acf8e
authored
Feb 07, 2024
by
齐文博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码更新
parent
9b409882
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
26 deletions
+36
-26
CodePage.py
kuangjia/paga/CodePage.py
+1
-1
CreatePage.py
kuangjia/paga/CreatePage.py
+4
-0
pytest.ini
kuangjia/pytest.ini
+1
-0
test_create.py
kuangjia/script/test_create.py
+0
-2
main.py
main.py
+30
-0
test_main.py
test_main.py
+0
-23
No files found.
kuangjia/paga/CodePage.py
View file @
2a2acf8e
...
@@ -19,7 +19,7 @@ class Code(BasePage):
...
@@ -19,7 +19,7 @@ class Code(BasePage):
# 创建按钮
# 创建按钮
self
.
reader_OR
=
(
By
.
XPATH
,
"/html/body/div/div/section/div[1]/div[2]/div/div[2]/div[2]/button[2]"
)
self
.
reader_OR
=
(
By
.
XPATH
,
"/html/body/div/div/section/div[1]/div[2]/div/div[2]/div[2]/button[2]"
)
# 配置服务
# 配置服务
self
.
reader_give
=
(
By
.
XPATH
,
"//b
ody//button[2
]"
)
self
.
reader_give
=
(
By
.
XPATH
,
"//b
utton[2]//span[1
]"
)
def
code
(
self
):
def
code
(
self
):
self
.
find_ele
(
self
.
reader_digital
)
.
click
()
self
.
find_ele
(
self
.
reader_digital
)
.
click
()
...
...
kuangjia/paga/CreatePage.py
View file @
2a2acf8e
...
@@ -44,6 +44,8 @@ class Create(BasePage):
...
@@ -44,6 +44,8 @@ class Create(BasePage):
"4]/div/div/div/div/button"
)
"4]/div/div/div/div/button"
)
# 书刊名称
# 书刊名称
self
.
reader_name
=
(
By
.
ID
,
"autoTextarea"
)
self
.
reader_name
=
(
By
.
ID
,
"autoTextarea"
)
#书刊封面
self
.
reader_book0
=
(
By
.
XPATH
,
"//div[@class='image-list-wrapper']//div[2]//button[1]//span[1]"
)
# 保存
# 保存
self
.
reader_primary
=
(
By
.
XPATH
,
"/html/body/div[1]/div/section/div[1]/div[2]/div/div[2]/div/div/button[2]"
)
self
.
reader_primary
=
(
By
.
XPATH
,
"/html/body/div[1]/div/section/div[1]/div[2]/div/div[2]/div/div/button[2]"
)
...
@@ -82,4 +84,6 @@ class Create(BasePage):
...
@@ -82,4 +84,6 @@ class Create(BasePage):
time
.
sleep
(
1
)
time
.
sleep
(
1
)
self
.
find_ele
(
self
.
reader_name
)
.
send_keys
(
"UI自动化书刊"
)
self
.
find_ele
(
self
.
reader_name
)
.
send_keys
(
"UI自动化书刊"
)
time
.
sleep
(
1
)
time
.
sleep
(
1
)
self
.
find_ele
(
self
.
reader_book0
)
.
click
()
time
.
sleep
(
1
)
self
.
find_ele
(
self
.
reader_primary
)
.
click
()
self
.
find_ele
(
self
.
reader_primary
)
.
click
()
kuangjia/pytest.ini
View file @
2a2acf8e
[pytest]
[pytest]
disable_test_id_escaping_and_forfeit_all_rights_to_community_support
=
True
disable_test_id_escaping_and_forfeit_all_rights_to_community_support
=
True
;addopts = -s --html=report/admin/test_admin_login.html --self-contained-html
;addopts = -s --html=report/admin/test_admin_login.html --self-contained-html
;addopts = pytest.main([r'--alluredir=./report/temp_jsonreport'])
testpaths
=
./script
testpaths
=
./script
python_files
=
test*
python_files
=
test*
python_classes
=
Test*
python_classes
=
Test*
...
...
kuangjia/script/test_create.py
View file @
2a2acf8e
...
@@ -49,5 +49,3 @@ class TestCreate:
...
@@ -49,5 +49,3 @@ class TestCreate:
a
=
get_text
(
self
.
login
.
login_info
)
a
=
get_text
(
self
.
login
.
login_info
)
assert
result
==
a
assert
result
==
a
print
(
a
)
print
(
a
)
main.py
0 → 100644
View file @
2a2acf8e
# import time
#
# import pytest
# from selenium.webdriver.common.by import By
#
# from kuangjia.Base.BasePage import BasePage
# from kuangjia.common.cutils import get_text
#
#
# class TestLogin:
# @pytest.mark.parametrize("user,password,result",
# [("黑泽爽子", "Rmb11111", "密码错误"), ("黑泽爽子1", "Rmb88888", "账号不存在")])
# def test_add(self, user, password, result):
# base = BasePage()
# base.driver.get('https://rays7.5rs.me/login')
# base.find_ele((By.ID, 'userName')).send_keys(user)
# time.sleep(3)
# base.find_ele((By.ID, 'pwd')).send_keys(password)
# base.find_ele((By.XPATH, "//button[@class='ant-btn ant-btn-primary ant-btn-lg ant-btn-block']//span")).click()
# time.sleep(1)
# a = get_text((By.XPATH, '/html/body/div[2]/div/div/div/div/div/span[2]'))
# assert result == a
# print(a)
import
os
import
pytest
pytest
.
main
([
r"D:\software\QiSelenium\kuangjia\script\test_create.py"
,
"-sv"
,
"--alluredir"
,
"./report/temp_jsonreport"
])
os
.
system
(
"allure generate ./report/temp_jsonreport -o ./report/html --clean"
)
test_main.py
deleted
100644 → 0
View file @
9b409882
import
time
import
pytest
from
selenium.webdriver.common.by
import
By
from
kuangjia.Base.BasePage
import
BasePage
from
kuangjia.common.cutils
import
get_text
class
TestLogin
:
@pytest.mark.parametrize
(
"user,password,result"
,
[(
"黑泽爽子"
,
"Rmb11111"
,
"密码错误"
),
(
"黑泽爽子1"
,
"Rmb88888"
,
"账号不存在"
)])
def
test_add
(
self
,
user
,
password
,
result
):
base
=
BasePage
()
base
.
driver
.
get
(
'https://rays7.5rs.me/login'
)
base
.
find_ele
((
By
.
ID
,
'userName'
))
.
send_keys
(
user
)
time
.
sleep
(
3
)
base
.
find_ele
((
By
.
ID
,
'pwd'
))
.
send_keys
(
password
)
base
.
find_ele
((
By
.
XPATH
,
"//button[@class='ant-btn ant-btn-primary ant-btn-lg ant-btn-block']//span"
))
.
click
()
time
.
sleep
(
1
)
a
=
get_text
((
By
.
XPATH
,
'/html/body/div[2]/div/div/div/div/div/span[2]'
))
assert
result
==
a
print
(
a
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment