Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
network-assets-reptile
Project
Project
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
liyang
network-assets-reptile
Commits
80fc8050
Commit
80fc8050
authored
Jul 20, 2023
by
liyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:debug ptt
parent
350a7d1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
createBrowserDriver.py
utils/createBrowserDriver.py
+11
-1
No files found.
utils/createBrowserDriver.py
View file @
80fc8050
...
...
@@ -9,6 +9,7 @@ from selenium.webdriver.support import expected_conditions as EC
from
selenium.webdriver.support.ui
import
WebDriverWait
import
chromedriver_autoinstaller
from
selenium.webdriver.firefox.firefox_profile
import
FirefoxProfile
# from mozprofile import FirefoxProfile
'''
创建浏览器实例
...
...
@@ -73,6 +74,7 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
firefox_profile_path
=
get_user_data_dir
()
# 将此处替换为你的Firefox用户数据目录路径
profile
=
FirefoxProfile
(
profile_directory
=
firefox_profile_path
)
options
.
profile
=
profile
options
else
:
options
.
add_argument
(
f
'--user-data-dir={get_user_data_dir()}'
)
...
...
@@ -89,8 +91,16 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
# linux 下的 chromedriver 默认加载路径是 /usr/local/bin/chromedriver
# 当然也可以通过 executable_path 自定义
if
web_browser
==
"firefox"
:
browser
=
webdriver
.
Firefox
(
options
=
options
)
# 创建Firefox浏览器对象并传入选项
extend
=
""
if
platform
.
system
()
==
'Windows'
:
extend
=
".exe"
else
:
extend
=
""
geckodriver_path
=
os
.
path
.
join
(
os
.
path
.
abspath
(
"./"
),
"drive"
,
"geckodriver"
,
extend
)
browser
=
webdriver
.
Firefox
(
options
=
options
,
executable_path
=
geckodriver_path
)
else
:
# 创建Chrome浏览器对象并传入选项
browser
=
webdriver
.
Chrome
(
options
=
options
)
return
browser
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