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
3d923ef6
Commit
3d923ef6
authored
Jan 14, 2024
by
齐文博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
5ec630b0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
1.py
test/1.py
+0
-0
appnium.py
test/appnium.py
+0
-0
test.py
test/test.py
+45
-0
No files found.
test/1.py
deleted
100644 → 0
View file @
5ec630b0
test/appnium.py
deleted
100644 → 0
View file @
5ec630b0
test/test.py
View file @
3d923ef6
import
time
import
action
as
action
# 安装selenium库
from
selenium
import
webdriver
from
selenium.webdriver.common.by
import
By
class
Login
:
# 把驱动对象存到成员变量中,方便调用
def
__init__
(
self
):
self
.
driver
=
webdriver
.
Edge
()
# 打开网页
self
.
driver
.
get
(
'https://adviser.raysgo.com/login'
)
self
.
driver
.
maximize_window
()
# 账号输入框的元素对象
def
find_user_name
(
self
):
ele
=
self
.
driver
.
find_element
(
By
.
XPATH
,
'/html/body/div/div/div[1]/div/section/div/div[2]/form/div/div[1]/div/div/input'
)
return
ele
# 密码输入框的元素对象
def
find_password
(
self
):
ele
=
self
.
driver
.
find_element
(
By
.
XPATH
,
'/html/body/div/div/div[1]/div/section/div/div[2]/form/div/div[2]/div/div/input'
)
return
ele
#
def
find_button
(
self
):
ele
=
self
.
driver
.
find_element
(
By
.
XPATH
,
'/html/body/div/div/div[1]/div/section/div/div[2]/form/div/div[4]'
)
return
ele
# 关闭浏览器
def
quit
(
self
):
self
.
driver
.
quit
()
login
=
Login
()
time
.
sleep
(
3
)
login
.
find_user_name
()
.
send_keys
(
"三味书屋"
)
time
.
sleep
(
3
)
login
.
find_password
()
.
send_keys
(
"Rmb123456"
)
time
.
sleep
(
3
)
login
.
find_button
()
.
click
()
time
.
sleep
(
3
)
login
.
quit
()
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