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
ba273fec
Commit
ba273fec
authored
Jan 30, 2024
by
齐文博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建书刊形成闭环
parent
ed730f0b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
13 deletions
+47
-13
cutils.py
kuangjia/common/cutils.py
+2
-4
config.py
kuangjia/config.py
+4
-0
DelPage.py
kuangjia/paga/DelPage.py
+16
-1
LoginPage.py
kuangjia/paga/LoginPage.py
+14
-5
test_create.py
kuangjia/script/test_create.py
+11
-3
No files found.
kuangjia/common/cutils.py
View file @
ba273fec
...
@@ -2,8 +2,8 @@ import json
...
@@ -2,8 +2,8 @@ import json
from
selenium.webdriver.support.wait
import
WebDriverWait
from
selenium.webdriver.support.wait
import
WebDriverWait
from
common.untils
import
DriverTools
from
kuangjia.
common.untils
import
DriverTools
from
config
import
file_path
from
kuangjia.
config
import
file_path
def
get_text
(
loc
,
time
=
10
,
fre
=
1
):
def
get_text
(
loc
,
time
=
10
,
fre
=
1
):
...
@@ -42,5 +42,3 @@ def read_json(file_name):
...
@@ -42,5 +42,3 @@ def read_json(file_name):
list1
.
append
(
temp
)
list1
.
append
(
temp
)
return
list1
return
list1
kuangjia/config.py
View file @
ba273fec
import
os
import
os
from
selenium.webdriver.support.wait
import
WebDriverWait
file_path
=
os
.
path
.
dirname
(
__file__
)
file_path
=
os
.
path
.
dirname
(
__file__
)
caps
=
{
caps
=
{
...
@@ -11,3 +13,5 @@ caps = {
...
@@ -11,3 +13,5 @@ caps = {
}
}
appium_server_url
=
"http://127.0.0.1:4723/wd/hub"
appium_server_url
=
"http://127.0.0.1:4723/wd/hub"
user_name
=
"黑泽爽子"
password
=
"Rmb88888"
kuangjia/paga/DelPage.py
View file @
ba273fec
import
time
import
time
import
action
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.support.wait
import
WebDriverWait
from
kuangjia.Base.BasePage
import
BasePage
from
kuangjia.Base.BasePage
import
BasePage
from
kuangjia.common.cutils
import
get_text
from
kuangjia.common.untils
import
DriverTools
from
kuangjia.common.untils
import
DriverTools
from
kuangjia.paga.CodePage
import
Code
from
kuangjia.paga.CodePage
import
Code
from
kuangjia.paga.CreatePage
import
Create
from
kuangjia.paga.CreatePage
import
Create
...
@@ -30,6 +33,8 @@ class Del(BasePage):
...
@@ -30,6 +33,8 @@ class Del(BasePage):
"4]//div[1]"
)
"4]//div[1]"
)
# 二次确认
# 二次确认
self
.
reader_confirm
=
(
By
.
XPATH
,
"//button[@class='ant-btn ant-btn-primary']//span"
)
self
.
reader_confirm
=
(
By
.
XPATH
,
"//button[@class='ant-btn ant-btn-primary']//span"
)
# 鼠标悬浮删除成功
self
.
person_name
=
(
By
.
XPATH
,
"//span[@class='title-text']"
)
def
delete
(
self
):
def
delete
(
self
):
self
.
find_ele
(
self
.
reader_fan
)
.
click
()
self
.
find_ele
(
self
.
reader_fan
)
.
click
()
...
@@ -45,6 +50,15 @@ class Del(BasePage):
...
@@ -45,6 +50,15 @@ class Del(BasePage):
self
.
find_ele
(
self
.
reader_delete
)
.
click
()
self
.
find_ele
(
self
.
reader_delete
)
.
click
()
time
.
sleep
(
1
)
time
.
sleep
(
1
)
self
.
find_ele
(
self
.
reader_confirm
)
.
click
()
self
.
find_ele
(
self
.
reader_confirm
)
.
click
()
time
.
sleep
(
1
)
get_text
(
self
.
person_name
)
if
__name__
==
'__main__'
:
DriverTools
.
get_driver
()
.
get
(
'https://rays7.5rs.me/login'
)
Login
()
.
login
()
Create
()
.
create
()
Code
()
.
code
()
Give
()
.
give
()
Del
()
.
delete
()
DriverTools
.
quit_driver
()
\ No newline at end of file
kuangjia/paga/LoginPage.py
View file @
ba273fec
from
datetime
import
time
import
time
from
selenium.webdriver.common.by
import
By
from
selenium.webdriver.common.by
import
By
from
kuangjia.Base.BasePage
import
BasePage
from
kuangjia.Base.BasePage
import
BasePage
from
kuangjia.common.untils
import
DriverTools
from
kuangjia.common.untils
import
DriverTools
from
kuangjia.common.cutils
import
get_text
from
kuangjia.config
import
user_name
,
password
class
Login
(
BasePage
):
class
Login
(
BasePage
):
...
@@ -14,10 +16,16 @@ class Login(BasePage):
...
@@ -14,10 +16,16 @@ class Login(BasePage):
# 登录密码
# 登录密码
self
.
follow_password
=
(
By
.
ID
,
'pwd'
)
self
.
follow_password
=
(
By
.
ID
,
'pwd'
)
# 登录按钮
# 登录按钮
self
.
person_login
=
(
self
.
person_login
=
(
By
.
XPATH
,
'/html/body/div/div/div/div[1]/div[3]/div/div/div[3]/form/div['
By
.
XPATH
,
'/html/body/div/div/div/div[1]/div[3]/div/div/div[3]/form/div[
4]/div/div/div/div/button'
)
'
4]/div/div/div/div/button'
)
def
login
(
self
):
def
login
(
self
):
self
.
find_ele
(
self
.
reader_username
)
.
send_keys
(
"黑泽爽子"
)
self
.
find_ele
(
self
.
reader_username
)
.
send_keys
(
user_name
)
self
.
find_ele
(
self
.
follow_password
)
.
send_keys
(
"Rmb88888"
)
self
.
find_ele
(
self
.
follow_password
)
.
send_keys
(
password
)
self
.
find_ele
(
self
.
person_login
)
.
click
()
self
.
find_ele
(
self
.
person_login
)
.
click
()
if
__name__
==
'__main__'
:
DriverTools
.
get_driver
()
.
get
(
'https://rays7.5rs.me/login'
)
Login
()
.
login
()
DriverTools
.
quit_driver
()
\ No newline at end of file
kuangjia/script/test_create.py
View file @
ba273fec
import
time
import
time
from
kuangjia.common.cutils
import
get_text
from
kuangjia.common.untils
import
DriverTools
from
kuangjia.common.untils
import
DriverTools
from
kuangjia.paga.CodePage
import
Code
from
kuangjia.paga.CodePage
import
Code
from
kuangjia.paga.CreatePage
import
Create
from
kuangjia.paga.CreatePage
import
Create
...
@@ -22,7 +23,14 @@ class TestCreate:
...
@@ -22,7 +23,14 @@ class TestCreate:
def
teardown_class
(
self
):
def
teardown_class
(
self
):
DriverTools
.
quit_driver
()
DriverTools
.
quit_driver
()
def
test_create
(
self
):
# 创建书刊流程
def
test_test1
(
self
):
self
.
login
.
login
()
self
.
login
.
login
()
time
.
sleep
(
3
)
self
.
create
.
create
()
self
.
code
.
code
()
self
.
give
.
give
()
self
.
delete
.
delete
()
result
=
get_text
(
self
.
delete
.
person_name
)
expect
=
"RAYS现代纸书"
assert
expect
==
result
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